richard1122 / vscode-youcompleteme

YouCompleteMe for VSCode
https://marketplace.visualstudio.com/items?itemName=RichardHe.you-complete-me
MIT License
53 stars 8 forks source link

VSCode fails to spawn ycmd (Windows) #54

Closed jgehrig closed 6 years ago

jgehrig commented 6 years ago

I just installed vscode-youcompleteme, and the plugin is having some trouble spawning the ycmd process. Autocomplete only works when I manually spawn ycmd from command prompt.

Logs attached. In this example, I have done the following: 1) Start VSCode 2) AutoComplete is NOT working 3) Inspect Log File Below 4) Extract command "C:/Python36/python.exe" "C:\\Users\\USERNAME\\vimfiles\\bundle\\YouCompleteMe\\third_party\\ycmd\\ycmd" "--port=16856" "--options_file=C:\\Users\\USERNAME\\AppData\\Local\\Temp\\2\\VSCodeYcmOptions-1527870139537" "--idle_suicide_seconds=600" from Output Logs 5) Open cmd.exe, run (paste) command from Step 4 6) AutoComplete WORKS

Any ideas on what might going wrong here? Is this a conf issue, or a bug?

Settings File:

{
    "ycmd.global_extra_config": "C:/Users/USERNAME/vimfiles/.ycm_extra_conf.py",

    "ycmd.path": "C:/Users/USERNAME/vimfiles/bundle/YouCompleteMe/third_party/ycmd",

    "ycmd.debug": true,

    "ycmd.python": "C:/Python36/python.exe",
}

Log Output (Abbreviated):

[start] optionsFile: C:\Users\USERNAME\AppData\Local\Temp\2\VSCodeYcmOptions-1527870139537
[_start] [ '/s',
  '/d',
  '/c',
  '""C:/Python36/python.exe" "C:\\Users\\USERNAME\\vimfiles\\bundle\\YouCompleteMe\\third_party\\ycmd\\ycmd" "--port=16856" "--options_file=C:\\Users\\USERNAME\\AppData\\Local\\Temp\\2\\VSCodeYcmOptions-1527870139537" "--idle_suicide_seconds=600""' ]
[_start] process spawn success undefined
[_start error] { Error: spawn cmd.exe ENOENT
    at exports._errnoException (util.js:1050:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn cmd.exe',
  path: 'cmd.exe',
  spawnargs: 
   [ '/s',
     '/d',
     '/c',
     '""C:/Python36/python.exe" "C:\\Users\\USERNAME\\vimfiles\\bundle\\YouCompleteMe\\third_party\\ycmd\\ycmd" "--port=16856" "--options_file=C:\\Users\\USERNAME\\AppData\\Local\\Temp\\2\\VSCodeYcmOptions-1527870139537" "--idle_suicide_seconds=600""' ] }
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[start] ycm started: undefined
richard1122 commented 6 years ago

It seems like cmd.exe is not in PATH ? Currently cmd is used to start new process (ycmd).

I'm not sure what happened here, maybe you can make sure cmd.exe is in C:/windows/system32 and this dir is in PATH?.

jgehrig commented 6 years ago

Thanks for the response on this Richard!

I changed my settings to the following and everything seems to be working:

{
    "ycmd.global_extra_config": "C:\\Users\\USERNAME\\vimfiles\\.ycm_extra_conf.py",

    "ycmd.path": "C:\\Users\\USERNAME\\vimfiles\\bundle\\YouCompleteMe\\third_party\\ycmd",

    "ycmd.debug": true,

    "ycmd.python": "C:\\Python36\\python.exe",
}

Looking closer at my first error log above (and knowing the conf fix) it appears ycmd.python forward slashes are not getting converted to backslashes? Notice the "C:/Python36/python.exe" in spawnargs.

Might the option ycmd.python need some additional slash handling code? Or is this expected?

richard1122 commented 6 years ago

I previously thought forward slash and double back slashes are both working on windows.

But maybe it's not.

I 'll do some test and if it's not working for forward slashes, it should be fixed.

Thanks for your reply.