diff options
Diffstat (limited to 'autoload/prettier.vim')
| -rw-r--r-- | autoload/prettier.vim | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/autoload/prettier.vim b/autoload/prettier.vim index bd47e60..2708caa 100644 --- a/autoload/prettier.vim +++ b/autoload/prettier.vim @@ -96,6 +96,7 @@ function! s:Prettier_Job_Nvim_Exit(status, info, out, err) abort echoerr join(a:err, "\n") return endif + if len(a:out) == 0 | return | endif let l:last = a:out[len(a:out) - 1] @@ -230,35 +231,6 @@ function! s:Prettier_Job_Error(msg) abort let s:prettier_job_running = 0 endfunction -function! s:Handle_Parsing_Errors(out) abort - let l:errors = [] - - for l:line in a:out - " matches: - " file.ext: SyntaxError: Unexpected token (2:8)sd - " stdin: SyntaxError: Unexpected token (2:8) - " [error] file.ext: SyntaxError: Unexpected token (2:8) - let l:match = matchlist(l:line, '^.*: \(.*\) (\(\d\{1,}\):\(\d\{1,}\)*)') - if !empty(l:match) - call add(l:errors, { 'bufnr': bufnr('%'), - \ 'text': l:match[1], - \ 'lnum': l:match[2], - \ 'col': l:match[3] }) - endif - endfor - - if len(l:errors) - let l:winnr = winnr() - call setqflist(l:errors, 'r') - botright copen - if !g:prettier#quickfix_auto_focus - " Return the cursor back to the main buffer. - exe l:winnr . 'wincmd w' - endif - let s:prettier_quickfix_open = 1 - endif -endfunction - function! s:Has_Content_Changed(content, startLine, endLine) abort return getbufline(bufnr('%'), 1, line('$')) == s:Get_New_Buffer(a:content, a:startLine, a:endLine) ? 0 : 1 endfunction @@ -454,7 +426,7 @@ endfunction function! s:Prettier_Parse_Error(errors) abort call prettier#logging#error#log('PARSING_ERROR') - if g:prettier#quickfix_enabled - call s:Handle_Parsing_Errors(a:errors) + if g:prettier#quickfix_enabled && prettier#bridge#parser#onError(a:errors) + let s:prettier_quickfix_open = 1 endif endfunction |
