sublimelsp / lsp_utils

Module with LSP-related utilities for Sublime Text
https://sublimelsp.github.io/lsp_utils/
MIT License
16 stars 6 forks source link

Make npm server install more robust #63

Closed rchl closed 3 years ago

rchl commented 3 years ago

Before the server installation we'll create a marker file that will only be removed on successful installation. So if the installation is interrupted by closing ST or otherwise we'll not end up with a broken installation that will then require re-installing the plugin.

predragnikolic commented 3 years ago

I tested this on windows.

  1. Make sure you have LSP-pyright installed or any other LSP-* plugin that user lsp_utils and set the following setting:

    // Settings in here override those in "lsp_utils/lsp_utils.sublime-settings"
    {
    "nodejs_runtime": ["local"],
    }
  2. Close ST.

  3. remove C:\Users\Predrag\AppData\Local\Sublime Text\Package Storage\lsp_utils

  4. Open ST, and open a *.py file and say yes to Install Node locally.

  5. Wait that the node installation starts.

  6. Quit ST immediately after that. (so that the node installation is not finished)

  7. Open ST. I get a popup to install Install Node locally. I confirm the modal and expect the Node installation to start again, but I see an error in the status bar LSP-pyright: Error: Failed installing a local Node.js runtime:

  8. I close ST and open it again, there is no error now and the node installation starts again.

The 7 step look suspicions, what is the expected behavior for step 7?

rchl commented 3 years ago

What's the next log line after LSP-pyright: Error: Failed installing a local Node.js runtime:?

I've tried that on mac and it seems to work fine here.

predragnikolic commented 3 years ago

What's the next log line after LSP-pyright: Error: Failed installing a local Node.js runtime:?

It's File is not a zip file.

Package Control: Installing 1 missing package
[lsp_utils] Installing Node.js 12.20.2
LSP-pyright: Error: Failed installing a local Node.js runtime:
File is not a zip file
reloading settings Packages/User/Package Control.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings

I also get this text printed in the ST status bar LSP-pyright: Error installing server dependencies at the same time I get LSP-pyright: Error: Failed installing a local Node.js runtime: (but I am not sure if which error throws first)

rchl commented 3 years ago

Are you able to debug it a bit? Removing those lines: https://github.com/sublimelsp/lsp_utils/blob/0977b81198e5d7388b51ab197731347052f29403/st3/lsp_utils/node_runtime.py#L252-L253 should ensure that the "not a zip file" is not removed so that you can inspect it manually.

rchl commented 3 years ago

I'm not able to reproduce on Windows and @predragnikolic will be away for a while so I'll just go ahead with it.