diff options
| author | mitermayer <mitermayer.reis@gmail.com> | 2018-05-04 12:09:01 -0700 |
|---|---|---|
| committer | mitermayer <mitermayer.reis@gmail.com> | 2019-08-25 21:11:49 -0700 |
| commit | ca9f2d3e391e7fd70b2948a22e9edc391b89cb0e (patch) | |
| tree | e8c71d2033a84b2d276a5ff80a25b01c39c5c4c7 /autoload/prettier/utils/quickfix.vim | |
| parent | dc3572ac2b10f091607bf8d1101604ed9b18b996 (diff) | |
| download | vim-prettier-ca9f2d3e391e7fd70b2948a22e9edc391b89cb0e.tar.xz | |
Refactoring out sync jobs and quickfix module
Diffstat (limited to 'autoload/prettier/utils/quickfix.vim')
| -rw-r--r-- | autoload/prettier/utils/quickfix.vim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/autoload/prettier/utils/quickfix.vim b/autoload/prettier/utils/quickfix.vim new file mode 100644 index 0000000..b4766a7 --- /dev/null +++ b/autoload/prettier/utils/quickfix.vim @@ -0,0 +1,22 @@ +" We use this flag so that we ensure only clearing quickfix if it was created by prettier itself +let s:prettier_quickfix_open = 0 + +function! prettier#utils#quickfix#close() abort + " close quickfix if it is opened + if s:prettier_quickfix_open + call setqflist([], 'r') + cclose + let s:prettier_quickfix_open = 0 + endif +endfunction + +function! prettier#utils#quickfix#open(errors, focus) abort + let s:prettier_quickfix_open = 1 + let l:winnr = winnr() + call setqflist(a:errors, 'r') + botright copen + if !a:focus + " Return the cursor back to the main buffer. + exe l:winnr . 'wincmd w' + endif +endfunction |
