diff options
| author | Mitermayer Reis <mitermayer.reis@gmail.com> | 2020-02-05 11:08:03 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-05 11:08:03 +1100 |
| commit | 49d91743b2df43f84edd199f877d494b4d8812f4 (patch) | |
| tree | cf856d77c9960a09eb3156937aa1b896b855bed6 /autoload/prettier/bridge/parser.vim | |
| parent | 9eb448e45ef88e90681335fda32bcae52a09d6dc (diff) | |
| parent | b064c6ab82a3c57ea64360d762d661ad7e8ee54c (diff) | |
| download | vim-prettier-49d91743b2df43f84edd199f877d494b4d8812f4.tar.xz | |
Merge pull request #175 from prettier/release/1.x
Release/1.x
Diffstat (limited to 'autoload/prettier/bridge/parser.vim')
| -rw-r--r-- | autoload/prettier/bridge/parser.vim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/autoload/prettier/bridge/parser.vim b/autoload/prettier/bridge/parser.vim new file mode 100644 index 0000000..51c4069 --- /dev/null +++ b/autoload/prettier/bridge/parser.vim @@ -0,0 +1,24 @@ +" TODO +" this function should just returns the parsed errors list instead +" of opening the quickfix +function! prettier#bridge#parser#onError(out, autoFocus) 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) + call prettier#utils#quickfix#open(l:errors, a:autoFocus) + endif +endfunction |
