@@ -77,7 +77,11 @@ function! s:Paint() abort
77
77
call add (lines , ' ' . fnamemodify (testfile, ' :.' ))
78
78
for name in keys (job.tests[testfile])
79
79
let test = job.tests[testfile][name]
80
- call add (lines , printf (' %s %s' , s: state2char [test.state ], name))
80
+ let state = s: state2char [test.state ]
81
+ call add (lines , printf (' %s %s' , state , name))
82
+ if state == # ' -' && ! has_key (test, ' spintimer' )
83
+ call s: SpinnerStart (test, len (lines ))
84
+ endif
81
85
endfor
82
86
endfor
83
87
call add (lines , ' ' )
@@ -92,6 +96,42 @@ function! s:Paint() abort
92
96
if bufnr () == s: testrunner_bufnr |call winrestview (winview) | endif
93
97
endfunction
94
98
99
+ function ! s: SpinnerSpin (test, lnum, timer) abort
100
+ if s: state2char [a: test .state ] !=# ' -'
101
+ call timer_stop (a: timer )
102
+ return
103
+ endif
104
+ let lines = getbufline (s: testrunner_bufnr , a: lnum )
105
+ if len (lines ) == 0
106
+ call timer_stop (a: timer )
107
+ return
108
+ endif
109
+ let line = lines [0 ]
110
+ let steps = get (g: , ' OmniSharp_testrunner_spinnersteps' , [
111
+ \ ' <*---->' , ' <-*--->' , ' <--*-->' , ' <---*->' ,
112
+ \ ' <----*>' , ' <---*->' , ' <--*-->' , ' <-*--->' ])
113
+ if ! has_key (a: test .spinner, ' index' )
114
+ let line .= ' -- ' . steps[0 ]
115
+ let a: test .spinner.index = 0
116
+ else
117
+ let a: test .spinner.index += 1
118
+ if a: test .spinner.index >= len (steps)
119
+ let a: test .spinner.index = 0
120
+ endif
121
+ let line = substitute (line , ' -- \zs.*$' , steps[a: test .spinner.index ], ' ' )
122
+ endif
123
+ call setbufvar (s: testrunner_bufnr , ' &modifiable' , 1 )
124
+ call setbufline (s: testrunner_bufnr , a: lnum , line )
125
+ call setbufvar (s: testrunner_bufnr , ' &modifiable' , 0 )
126
+ endfunction
127
+
128
+ function ! s: SpinnerStart (test, lnum) abort
129
+ let a: test .spinner = {}
130
+ let a: test .spinner.timer = timer_start (300 ,
131
+ \ funcref (' s:SpinnerSpin' , [a: test , a: lnum ]),
132
+ \ {' repeat' : -1 })
133
+ endfunction
134
+
95
135
function ! OmniSharp#testrunner#SetTests (bufferTests) abort
96
136
let winid = win_getid ()
97
137
for buffer in a: bufferTests
0 commit comments