neoclide / coc-vetur

Vue language server extension for coc.nvim
219 stars 7 forks source link

VLS hangs on starting stage but works if vetur.dev.vlsPath specified #56

Closed emarbo closed 3 years ago

emarbo commented 3 years ago

Description

Hi everyone and thanks for this extension! I couldn't work without it :heart:.

The problem is the extension is not working by default but works setting the vetur.dev.vlsPath to the VLS directory. I mean, the same VLS directory installed by the coc-vetur extension.

Looks like coc-vetur launches the vls.js by default but the vueServerMain.js when vetur.dev.vlsPath is set. The VSCode looks running vueServerMain.js as well.

Is this a bug? Or I'm doing something wrong? See below the steps I've done and the logs output.

What is happening

The :CocInfo shows VLS is starting but never changes to running. The autocomplete for .vue files does not work at all.

CocInfo Logs

``` ## versions vim version: NVIM v0.4.4 node version: v12.19.0 coc.nvim version: 0.0.79-53f8a1d52b coc.nvim directory: /home/earenas/.config/nvim/plugged/coc.nvim term: xterm-color platform: linux ## Log of coc.nvim 2020-11-13T18:23:53.371 INFO (pid:1658836) [services] - registered service "eslint" 2020-11-13T18:23:53.373 INFO (pid:1658836) [services] - eslint langserver state change: stopped => starting 2020-11-13T18:23:53.384 INFO (pid:1658836) [services] - registered service "json" 2020-11-13T18:23:53.384 INFO (pid:1658836) [services] - Json language server state change: stopped => starting 2020-11-13T18:23:53.395 INFO (pid:1658836) [services] - registered service "vetur" 2020-11-13T18:23:53.396 INFO (pid:1658836) [services] - Vetur Language Server state change: stopped => starting 2020-11-13T18:23:53.398 INFO (pid:1658836) [plugin] - coc.nvim 0.0.79-53f8a1d52b initialized with node: v12.19.0 after 98ms 2020-11-13T18:23:53.409 INFO (pid:1658836) [language-client-index] - eslint started with 1658851 2020-11-13T18:23:53.416 INFO (pid:1658836) [language-client-index] - json started with 1658858 2020-11-13T18:23:53.420 INFO (pid:1658836) [language-client-index] - vetur started with 1658864 2020-11-13T18:23:53.469 INFO (pid:1658836) [services] - eslint langserver state change: starting => running 2020-11-13T18:23:53.473 INFO (pid:1658836) [services] - service eslint started 2020-11-13T18:23:53.499 INFO (pid:1658836) [services] - Json language server state change: starting => running 2020-11-13T18:23:53.502 INFO (pid:1658836) [services] - service json started ```

What should happen

The VLS should change from starting to running, and autocomplete from LS should work.

What I have tested so far

I have downloaded veturpack and followed the instructions to install coc-vetur.

:heavy_check_mark: The autocomplete works fine for .ts and .js files but not working at all for .vue files.

Inspecting the processes I see coc-vetur launches the vls.js file as follows:

/home/earenas/.nvm/versions/node/v12.19.0/bin/node /home/earenas/.config/coc/extensions/node_modules/vls/dist/vls.js --node-ipc --clientProcessId=1658836

:heavy_check_mark: Changing the vetur.dev.vlsPath as follows SOLVES the issue for me:

{
  "eslint.autoFixOnSave": true,
  "eslint.filetypes": ["javascript", "typescript", "vue"],
  "vetur.validation.template": false,
  "vetur.trace.server": "verbose",
  "vetur.dev.logLevel": "DEBUG",
  "vetur.dev.vlsPath": "/home/earenas/.config/coc/extensions/node_modules/vls"
}

And, in this case, the launched process is vueServerMain.js:

/home/earenas/.nvm/versions/node/v12.19.0/bin/node /home/earenas/.config/coc/extensions/node_modules/vls/dist/vueServerMain.js --node-ipc --clientProcessId=1674163

And :CocInfo shows the process in running state:

CocInfo Logs

``` vim version: NVIM v0.4.4 node version: v12.19.0 coc.nvim version: 0.0.79-53f8a1d52b coc.nvim directory: /home/earenas/.config/nvim/plugged/coc.nvim term: xterm-color platform: linux ## Log of coc.nvim 2020-11-13T18:34:01.140 INFO (pid:1674163) [services] - registered service "eslint" 2020-11-13T18:34:01.142 INFO (pid:1674163) [services] - eslint langserver state change: stopped => starting 2020-11-13T18:34:01.153 INFO (pid:1674163) [services] - registered service "json" 2020-11-13T18:34:01.154 INFO (pid:1674163) [services] - Json language server state change: stopped => starting 2020-11-13T18:34:01.164 INFO (pid:1674163) [services] - registered service "vetur" 2020-11-13T18:34:01.164 INFO (pid:1674163) [services] - Vetur Language Server state change: stopped => starting 2020-11-13T18:34:01.166 INFO (pid:1674163) [plugin] - coc.nvim 0.0.79-53f8a1d52b initialized with node: v12.19.0 after 98ms 2020-11-13T18:34:01.178 INFO (pid:1674163) [language-client-index] - eslint started with 1674180 2020-11-13T18:34:01.187 INFO (pid:1674163) [language-client-index] - json started with 1674187 2020-11-13T18:34:01.193 INFO (pid:1674163) [language-client-index] - vetur started with 1674193 2020-11-13T18:34:01.243 INFO (pid:1674163) [services] - eslint langserver state change: starting => running 2020-11-13T18:34:01.249 INFO (pid:1674163) [services] - service eslint started 2020-11-13T18:34:01.273 INFO (pid:1674163) [services] - Json language server state change: starting => running 2020-11-13T18:34:01.276 INFO (pid:1674163) [services] - service json started 2020-11-13T18:34:02.514 INFO (pid:1674163) [services] - Vetur Language Server state change: starting => running 2020-11-13T18:34:02.516 INFO (pid:1674163) [services] - service vetur started ```

chemzqm commented 3 years ago

It's not loading vls.js, should be fixed by upgrade vls of coc-vetur.

emarbo commented 3 years ago

Hi @chemzqm, thanks for the fix. Now, it works without specifying vlsPath :+1: :clap: