neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.36k stars 956 forks source link

Some CoC extension features doesn't work when there's a space in the home directory on Windows #4964

Open nelsyeung opened 6 months ago

nelsyeung commented 6 months ago

Result from CocInfo

versions

vim version: VIM - Vi IMproved 9.1 9010000 node version: v18.20.0 coc.nvim version: 0.0.82-9190bfef 2024-03-26 09:16:19 +0800 coc.nvim directory: C:\Users\Nelson Yeung.vim\plugged\coc.nvim term: undefined platform: win32

Log of coc.nvim

2024-03-29T11:53:39.631 WARN (pid:17352) [workspace] - workspace.createStatusBarItem is deprecated, please use window.createStatusBarItem instead. 
    at Object.<anonymous> (C:\Users\Nelson Yeung\AppData\Local\coc\extensions\node_modules\coc-powershell\out\client\extension.js:175:51)
    at Generator.next (<anonymous>)
2024-03-29T11:53:39.632 WARN (pid:17352) [workspace] - workspace.createOutputChannel is deprecated, please use window.createOutputChannel instead. 
    at new PowerShellProcess (C:\Users\Nelson Yeung\AppData\Local\coc\extensions\node_modules\coc-powershell\out\client\process.js:30:37)
    at C:\Users\Nelson Yeung\AppData\Local\coc\extensions\node_modules\coc-powershell\out\client\extension.js:65:20
2024-03-29T11:53:39.633 WARN (pid:17352) [workspace] - workspace.createTerminal is deprecated, please use window.createTerminal instead. 
    at PowerShellProcess.<anonymous> (C:\Users\Nelson Yeung\AppData\Local\coc\extensions\node_modules\coc-powershell\out\client\process.js:65:59)
    at Generator.next (<anonymous>)
2024-03-29T11:53:39.636 INFO (pid:17352) [plugin] - coc.nvim initialized with node: v18.20.0 after 382
2024-03-29T11:53:39.645 INFO (pid:17352) [attach] - receive notification: highlight []
2024-03-29T11:53:44.574 ERROR (pid:17352) [timing] - activate coc-powershell timeout after 5000ms
2024-03-29T11:55:06.417 INFO (pid:17352) [attach] - receive notification: showInfo []

Describe the bug

I'm getting this error when using coc-powershell:

C:\Users\Nelson : The term 'C:\Users\Nelson' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
at line:1 char:1
+ C:\Users\Nelson Yeung\ AppData\Local\coc\extensions\node_modules\coc-p ...

As can be seen, the path is incomplete, my full home directory path is C:\Users\Nelson Yeung. Hence, the term: undefined in CocInfo.

I'm logging this issue here because I believe it's a wider problem as some other CoC extensions like coc-flutter and coc-prettier don't work too. Although, admittedly, I don't know whether it's related to this problem.

Reproduce the bug

Screenshots (optional)

Screenshot 2024-03-29 120654

fannheyward commented 6 months ago

I don't have an environment to debug on Windows in order to get the full home directory. Any help would be greatly appreciated.