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

fix npm install not running when local node_modules exists #91

Closed rchl closed 2 years ago

rchl commented 2 years ago

This fixes an issue that would only potentially affect developers working on LSP-* packages.

If someone did an npm install in, for example, a local LSP-pyright/language-server/ repository then lsp_utils would not run npm install even after dependency is bumped in package.json which means that ST would use old version of the server.

I'm not sure why this check for node_modules already existing was there. Since install_or_update only runs when needs_installation decided that it needs to be installed, it seems to make sense to do it unconditionally. But I might be forgetting some case that it optimized...

@predragnikolic this is likely the reason you had similar issue before with server not updating.

predragnikolic commented 2 years ago

I'm not sure why this check for node_modules already existing was there.

I have a theory. Once upon a time, there was this code: https://github.com/sublimelsp/LSP-html/blob/73b085581f2094173f45e99bc668889488ec600e/plugin.py#L17

I guess we just migrated that piece of code to lsp_utils from the past code when we were starting with LSP-* plugins.

Now that check is not necessary, because there are other ways to determine when to update the server.

rchl commented 2 years ago

Thanks for digging. :) Let's try it.