feat(node): add pnpm support #19461

This commit is contained in:
Percy Ma
2022-08-01 22:21:54 +08:00
committed by GitHub
parent 8d1c55e422
commit c6181a672a
2 changed files with 29 additions and 7 deletions

View File

@@ -82,6 +82,13 @@ function! provider#node#Detect() abort
let yarn_opts.job_id = jobstart('yarn global dir', yarn_opts)
endif
let pnpm_opts = {}
if executable('pnpm')
let pnpm_opts = deepcopy(s:NodeHandler)
let pnpm_opts.entry_point = '/neovim/bin/cli.js'
let pnpm_opts.job_id = jobstart('pnpm --loglevel silent root -g', pnpm_opts)
endif
" npm returns the directory faster, so let's check that first
if !empty(npm_opts)
let result = jobwait([npm_opts.job_id])
@@ -97,6 +104,13 @@ function! provider#node#Detect() abort
endif
endif
if !empty(pnpm_opts)
let result = jobwait([pnpm_opts.job_id])
if result[0] == 0 && pnpm_opts.result != ''
return [pnpm_opts.result, '']
endif
endif
return ['', 'failed to detect node']
endfunction