Skip to content

LS job fails on windows vim if &shell is powershell #276

@MiguelBarro

Description

@MiguelBarro

The language server runs in node.js and is launched using:

 > 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:

    job_start(['npx', '@github/copilot-language-server@^1.408.0', '--stdio'], ...)

which fails (is a win32 CreateProcess(...) issue) and should instead use:

    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$\|^$'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions