github / github/copilot.vim

LS job fails on windows vim if &shell is powershell

未關閉
#276 1 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Vim Script
星號
11.7k
分支
810
PR 合併指標
30 天內沒有已合併 PR

描述

The language server runs in node.js and is launched using:
```pwsh
> npx @github/copilot-language-server@^1.408.0 --stdio
```
the problem is that the plugin (see `copilot.vim/autoload/copilot/client.vim` function `copilot#client#New()`)
uses:
```vim
job_start(['npx', '@github/copilot-language-server@^1.408.0', '--stdio'], ...)
```
which fails (is a win32 `CreateProcess(...)` issue) and should instead use:
```vim
job_start('npx "@github/copilot-language-server@^1.408.0" --stdio', ...)
```
The following patch works for me:
```
diff --git a/autoload/copilot/client.vim b/autoload/copilot/client.vim
index c3ec862..c052bc8 100644
--- a/autoload/copilot/client.vim
+++ b/autoload/copilot/client.vim
@@ -736,7 +736,7 @@ function! copilot#client#New() abort
let instance.workspaceFolders[folder.uri] = v:true
endfor
call copilot#logger#Debug('Spawning ' . join(command, ' '))
- let is_win_shell = has('win32') && &shellcmdflag !~# '^-'
+ let is_win_shell = has('win32') && ( &shell =~? 'powershell\|pwsh' || &shellcmdflag !~# '^-')
if is_win_shell && command[0] !~# '[\/]'
let exepath = exepath(command[0])
if exepath !~? '\.exe$\|^$'
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。