sublimelsp / LSP-vue

Vue support for Sublime's LSP plugin
MIT License
29 stars 3 forks source link

Language server lsp-vue has crashed, do you want to restart it? #23

Closed Guanqing-cool closed 4 years ago

Guanqing-cool commented 4 years ago

After downloading the lsp-vue , I can't use it. Open the Vue file and the message "language server LSP Vue has crashed, do you want to restart it?". It's still useless to restart it. What causes the language server to fail?And how do I fix it。

rchl commented 4 years ago

Check ST console and LSP: Toggle Log Panel for any relevant errors or paste here.

Guanqing-cool commented 4 years ago

Check ST console and LSP: Toggle Log Panel for any relevant errors or paste here.

Sorry, the console doesn't seem to show any errors. It's just a sublime text window that pops up when the Vue file is loaded about a problem with the language server. This is my screenshot of the problem.

error
rchl commented 4 years ago

Check also the other log panel that I've mentioned. You can open it from command palette.

And the contents of Vue file can also be the reason.

Guanqing-cool commented 4 years ago

Check also the other log panel that I've mentioned. You can open it from command palette.

And the contents of Vue file can also be the reason.

OK, I switched to the log panel with two messages: lsp-vue: Loaded bundled typescript@3.7.4. lsp-vue: Vetur initialized

toggle log  panel
rchl commented 4 years ago

That still doesn't tell us anything. I saw part off the Vue file in your screenshot and it looked rather weird - you were initialising Vue there which you wouldn't typically do in a Vue file. Are you able to share the file or whole repo?

Guanqing-cool commented 4 years ago

That still doesn't tell us anything. I saw part off the Vue file in your screenshot and it looked rather weird - you were initialising Vue there which you wouldn't typically do in a Vue file. Are you able to share the file or whole repo?

Thank you for your sincere answer to my question. At first, in order to test lsp-vue, I just changed the HTML file to Vue file directly. After your guidance, I used vue cli to create a simple Vue project in cmd. However, when I used sublime to open the vue file in the project, the previous problems still occurred. Do Vue files need any other conditions or environments?

new vue file
rwols commented 4 years ago

Did you try removing the Vetur language server from Sublime’s Cache dir? Perhaps the installation did not succeed. When Vetur is removed, this package will re-install it.

rchl commented 4 years ago

It's probably easier to just reinstall lsp-vue package than hunting the cache directory. That will also clear the cache.

There is one thing I forgot to mention before... To possibly see the error that vetur throws, you also should enable all log_* settings in LSP preferences.

Guanqing-cool commented 4 years ago

Did you try removing the Vetur language server from Sublime’s Cache dir? Perhaps the installation did not succeed. When Vetur is removed, this package will re-install it.

In sublime's cash directory, I did not find the vetur language server. There is a folder called vue -language -server. In its subdirectory, there is the vetursnippets folder. I tried to reinstall lsp-vue many times, but it still didn't work.

rwols commented 4 years ago

From your logs:

lsp-vue: throw error;
lsp-vue: ^
lsp-vue:
lsp-vue: Error: Could not find source file: 'c:\Users\Zhu Guanqing\Desktop\code\my-vue\src\App.vue.template'.

Is the file App.vue.template present?

rchl commented 4 years ago

I don't think it's really supposed to be present on a typical Vue app. Would have to look at vetur code to see why it's expecting that.

rchl commented 4 years ago

@Guanqing-cool could you first sort out some more fundamental issues like:

Unable to open /C/Users/Zhu Guanqing/Desktop/temp/Sublime Text Build 3211 x64/Data/Packages/LSP/LSP.sublime-settings

? There is something wrong with accessing files on your system. Possibly because you have everything under Desktop which might have special permission handling.

Maybe install ST properly in Program Files and then try it out again. Could also move your project to user's Documents for example.

rchl commented 4 years ago

It's also suspicious that you have LSP installed in Packages. It should be installed in Installed Packages if you install it normally through Package Control.

Guanqing-cool commented 4 years ago

It's also suspicious that you have LSP installed in Packages. It should be installed in Installed Packages if you install it normally through Package Control.

I'm sure I installed it from Package Control in the normal way. I only have three plug-ins installed: LSP ,Vue Syntax Highlight , lsp-vue

installed package packages
Guanqing-cool commented 4 years ago

@Guanqing-cool could you first sort out some more fundamental issues like:

Unable to open /C/Users/Zhu Guanqing/Desktop/temp/Sublime Text Build 3211 x64/Data/Packages/LSP/LSP.sublime-settings

? There is something wrong with accessing files on your system. Possibly because you have everything under Desktop which might have special permission handling.

Maybe install ST properly in Program Files and then try it out again. Could also move your project to user's Documents for example.

I also installed sublime on disk D, but it still have the same problem. Is it because I use the portable version of sublime?

rchl commented 4 years ago

What version of node are you running?

Guanqing-cool commented 4 years ago

What version of node are you running?

v12.14.1

rchl commented 4 years ago

I'm running the same vetur code, tried same node version and same lsp-vue settings and still can't reproduce.

The error about App.vue.template is confusing because that file is not supposed to exist physically. It's created "virtually" by vetur and passed to typescript for parsing. That parsing fails for you somehow. Not sure what's the actual issue there.

rchl commented 4 years ago

I've booted my Windows machine and was actually able to reproduce easily there.

Turns out the new version of VLS doesn't crash so I've created PR to update to latest version - #24

kapitanluffy commented 4 years ago

I made it work for now by using the vls binary found in my path. Here's my fork

If the vls binary does not work, You may need to manually compile vetur server. The latest vls version (0.2.0) also has this issue https://github.com/vuejs/vetur/issues/1840 (at least for me).

You will then need to manually use the newly compiled version in the plugin. image

It has an error in linking definitions from the template though. Everything else seem to work fine. image

It would be great if we can define the binary from the settings instead of relying for it to automatically install node dependencies in the background. I hope you can make yours work 😄

rchl commented 4 years ago

The whole point of LSP-vue (and other LSP-* packages) is to handle dependencies for you. If you want to use your local dependency, just manually configure LSP like described in https://lsp.readthedocs.io/en/latest/#server-configuration . No need for LSP-vue then.

We know that new VLS version has another crashing issue, that's why we are holding off with https://github.com/sublimelsp/LSP-vue/pull/24 .

We could manually compile it, or add extra dependencies, but we'd rather avoid that extra work and just wait for upstream to release new version.

rchl commented 4 years ago

Should be fixed in just released version https://github.com/sublimelsp/LSP-vue/releases/tag/0.0.18