aboutsummaryrefslogtreecommitdiff
path: root/autoload/prettier
diff options
context:
space:
mode:
authorMitermayer Reis <mitermayer.reis@gmail.com>2020-09-07 19:36:23 +1000
committerGitHub <noreply@github.com>2020-09-07 19:36:23 +1000
commit340182bbfedd18dd3eb3cac8adc62be0de90b3f4 (patch)
treedd57b367910b336c7f7297cc5e2b0aa804a48cec /autoload/prettier
parente12223182a51c85528159cb8baf4339998eb9797 (diff)
parentec8dc2bc344985c09e34fd6a4aff73702e2b7967 (diff)
downloadvim-prettier-340182bbfedd18dd3eb3cac8adc62be0de90b3f4.tar.xz
Merge branch 'master' into issue/232-adding-support-for-prettier-2.x
Diffstat (limited to 'autoload/prettier')
-rw-r--r--autoload/prettier/job/async/neovim.vim2
-rw-r--r--autoload/prettier/resolver/executable.vim7
2 files changed, 8 insertions, 1 deletions
diff --git a/autoload/prettier/job/async/neovim.vim b/autoload/prettier/job/async/neovim.vim
index 7f69f4e..35e5f82 100644
--- a/autoload/prettier/job/async/neovim.vim
+++ b/autoload/prettier/job/async/neovim.vim
@@ -42,6 +42,8 @@ endfunction
"
" note that somehow we exectuing both async and sync on nvim when using the autoformat
function! s:onExit(status, info, out, err) abort
+ if len(a:out) == 0 | return | endif
+
let l:currentBufferNumber = bufnr('%')
let l:isInsideAnotherBuffer = a:info.buf_nr != l:currentBufferNumber ? 1 : 0
let l:last = a:out[len(a:out) - 1]
diff --git a/autoload/prettier/resolver/executable.vim b/autoload/prettier/resolver/executable.vim
index 8d233ab..0cb0b02 100644
--- a/autoload/prettier/resolver/executable.vim
+++ b/autoload/prettier/resolver/executable.vim
@@ -33,7 +33,12 @@ endfunction
function! s:GetExecPath(...) abort
let l:rootDir = a:0 > 0 ? a:1 : -1
let l:dir = l:rootDir != -1 ? l:rootDir . '/.bin/' : ''
- return l:dir . 'prettier'
+ let l:path = l:dir . get(b:, 'prettier_exec_cmd', 'prettier')
+ if executable(l:path)
+ return l:path
+ else
+ return l:dir . 'prettier'
+ endif
endfunction
" Searches for the existence of a directory accross