@@ -7,6 +7,16 @@ let s:runner = get(s:, 'runner', {})
7
7
8
8
9
9
function ! OmniSharp#testrunner#Debug () abort
10
+ let filename = ' '
11
+ let line = getline (' .' )
12
+ if line = ~# ' ^\a' || line = ~# ' ^ \f'
13
+ return s: utils .log .warn (' Select a test to debug' )
14
+ else
15
+ let test = s: utils .findTest ()
16
+ if has_key (test, ' filename' )
17
+ call OmniSharp#actions#test#Debug (0 , test.filename, test.name)
18
+ endif
19
+ endif
10
20
endfunction
11
21
12
22
@@ -243,23 +253,18 @@ endfunction
243
253
244
254
function ! OmniSharp#testrunner#SetBreakpoints () abort
245
255
if ! OmniSharp#util#HasVimspector ()
246
- echohl WarningMsg
247
- echomsg ' Vimspector required to set breakpoints'
248
- echohl None
249
- return
256
+ return s: utils .log .warn (' Vimspector required to set breakpoints' )
250
257
endif
251
258
let line = getline (' .' )
252
259
" Stack trace with valid location (filename and possible line number)
253
260
let parsed = matchlist (line , ' ^> \+__ .* ___ \(.*\) __ \%(line \(\d\+\)\)\?$' )
254
261
if len (parsed) && parsed[2 ] !=# ' '
255
262
call vimspector#SetLineBreakpoint (parsed[1 ], str2nr (parsed[2 ]))
256
- echomsg ' Break point set'
257
- return
263
+ return s: utils .log .emphasize (' Break point set' )
258
264
endif
259
265
let test = s: utils .findTest ()
260
266
if ! has_key (test, ' stacktrace' )
261
- echo ' No breakpoints added'
262
- return
267
+ return s: utils .log .emphasize (' No breakpoints added' )
263
268
endif
264
269
let bps = filter (copy (test.stacktrace),
265
270
\ " has_key(v:val, 'filename') && has_key(v:val, 'lnum')" )
@@ -268,7 +273,7 @@ function! OmniSharp#testrunner#SetBreakpoints() abort
268
273
endfor
269
274
let n = len (bps)
270
275
let message = printf (' %d break point%s set' , n , n == 1 ? ' ' : ' s' )
271
- echomsg message
276
+ return s: utils . log . emphasize ( message)
272
277
endfunction
273
278
274
279
@@ -434,6 +439,7 @@ endfunction
434
439
435
440
436
441
let s: utils = {}
442
+ let s: utils .log = {}
437
443
438
444
let s: utils .state2char = {
439
445
\ ' Not run' : ' |' ,
@@ -474,6 +480,24 @@ function! s:utils.getProjectName(bufnr) abort
474
480
return get (msbuildproject, ' AssemblyName' , ' _Default' )
475
481
endfunction
476
482
483
+ function ! s: utils .log .echo (highlightGroup, message) abort
484
+ let messageLines = type (a: message ) == type ([]) ? a: message : [a: message ]
485
+ execute ' echohl' a: highlightGroup
486
+ for messageLine in messageLines
487
+ echomsg messageLine
488
+ endfor
489
+ echohl None
490
+ endfunction
491
+
492
+ function ! s: utils .log .emphasize (message) abort
493
+ call self .echo (' Title' , a: message )
494
+ return 1
495
+ endfunction
496
+
497
+ function ! s: utils .log .warn (message) abort
498
+ call self .echo (' WarningMsg' , a: message )
499
+ return 0
500
+ endfunction
477
501
478
502
let &cpoptions = s: save_cpo
479
503
unlet s: save_cpo
0 commit comments