1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 07:10:06 +08:00

Update syntax file for runner

This commit is contained in:
wsdjeg 2017-12-04 20:24:41 +08:00
parent 9128f24fd2
commit 4fa20f8a10
2 changed files with 25 additions and 3 deletions

View File

@ -67,6 +67,13 @@ function! s:on_compile_exit(id, data, event) abort
\ 'on_stderr' : function('s:on_stderr'),
\ 'on_exit' : function('s:on_exit'),
\ })
else
let s:end_time = reltime(s:start_time)
let s:status.is_exit = 1
let s:status.exit_code = a:data
let done = ['', '[Done] exited with code=' . a:data . ' in ' . s:STRING.trim(reltimestr(s:end_time)) . ' seconds']
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, done)
call s:update_statusline()
endif
endfunction
@ -120,9 +127,20 @@ if has('nvim') && exists('*chanclose')
let s:_err_data = ['']
function! s:on_stderr(job_id, data, event) abort
let s:status.has_errors = 1
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data)
let s:lines += len(a:data)
let s:_out_data[-1] .= a:data[0]
call extend(s:_out_data, a:data[1:])
if s:_out_data[-1] == ''
call remove(s:_out_data, -1)
let lines = s:_out_data
else
let lines = s:_out_data
endif
if !empty(lines)
call add(g:wsd, lines)
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, lines)
endif
let s:lines += len(lines)
let s:_out_data = ['']
call s:update_statusline()
endfunction
else

View File

@ -9,8 +9,12 @@ syn match RunnerCmd /\(\[Running\]\ \)\@<=.*/
syn match RunnerCmd /\(\[Compile\]\ \)\@<=.*/
syn match DoneSucceeded /\[Done]\(\ exited\ with\ code=0\)\@=/
syn match DoneFailed /\[Done]\(\ exited\ with\ code=[^0]\)\@=/
syn match ExitCode /\(\[Done\]\ exited\ with \)\@<=code=0/
syn match ExitCodeFailed /\(\[Done\]\ exited\ with \)\@<=code=[^0]/
hi def link RunnerCmd Comment
hi def link KeyBindings String
hi def link DoneSucceeded String
hi def link DoneFailed WarningMsg
hi def link ExitCode MoreMsg
hi def link ExitCodeFailed WarningMsg