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

Multiple versions of Language Servers files after nodejs update/change. #90

Closed broiniac closed 1 year ago

broiniac commented 2 years ago

Describe the bug There are many versions of Language Servers stored in Package Storage directory. After some time total size can be larger than expected, since each of them has its own copy of dependencies (node_modules). Based on directories names I guess that each time I update or change system nodejs version LSP installs fresh copy of Language Server.

In my case:

There are no cache/index files counted in the above.

To Reproduce Steps to reproduce the behavior:

  1. Install LSP
  2. Install some Langague Servers
  3. Use Language Servers for a while
  4. Change system node version
  5. Use Language Servers for a while
  6. Check size and subdirectories of Package Storage

Expected behavior Old versions of Language Servers should be removed on node update or after some time. Maybe there should be setting for keeping n latest versions? Use-case might be very limited, so I don't think this is needed. But keeping latest versions only should be an option.

Screenshots https://i.imgur.com/yT4dFlR.png

Environment (please complete the following information):

rchl commented 2 years ago

As far as node this is an lsp_utils issue so transferring to correct repo.

rchl commented 2 years ago

Technically it's easy to implement a cleanup but not sure how it should work from the user's perspective.

I imagine that on starting a particular server we could check whether there exist any unexpected directories in package's storage and offer to delete them by showing a dialog. Not sure I want to just automatically clean those out...

LDAP commented 1 year ago

This is also an issue if language servers are updated by the plugin maintainer / dependabot.

For example, in my Package Storage there are 18 versions of pyright, 13 of bash, 6 of CSS, 4 of dockerfile, 12 of eslint, 10 of html, 22 of json, 2 of angular, 7 of typescript and 14 of yaml. This adds up to around 2 GB.

rchl commented 1 year ago

This is also an issue if language servers are updated by the plugin maintainer / dependabot.

That should not be the case. The directory structure is like .../Package Storage/LSP-pyright/16.15.0/language-server so new versions of server just overwrite the old one.

LDAP commented 1 year ago

With "update" I mean changing the version number. My Package Storage looks like this:

~/.cac/sublime-text/Package Storage  ls */                                            ✔ 
AutoSetSyntax/:
guesslang-server

LSP-angular/:
18.3.0  18.6.0

LSP-bash/:
17.2.0  17.6.0  17.9.0  18.3.0  18.9.0  19.0.0  19.1.0
17.3.0  17.8.0  18.2.0  18.8.0  18.9.1  19.0.1

LSP-clangd/:
clangd_15.0.1

LSP-css/:
17.4.0  17.5.0  17.6.0  17.8.0  17.9.0  18.3.0

LSP-dockerfile/:
17.3.0  17.9.0  18.2.0  19.1.0

LSP-eslint/:
17.4.0  17.6.0  17.9.0   18.3.0  18.7.0  19.0.1
17.5.0  17.8.0  18.10.0  18.6.0  18.8.0  19.1.0

LSP-file-watcher-chokidar/:
chokidar

LSP-gopls/:
bin  go-build  pkg  VERSION

LSP-html/:
17.3.0  17.4.0  17.5.0  17.6.0  17.8.0  17.9.0  18.7.0  18.8.0  19.0.1  19.1.0

LSP-jdtls/:
data  server

LSP-json/:
17.3.0  17.5.0  17.7.2  17.9.0  18.10.0  18.2.0  18.5.0  18.7.0  18.9.0  19.0.0  19.1.0
17.4.0  17.6.0  17.8.0  18.1.0  18.11.0  18.3.0  18.6.0  18.8.0  18.9.1  19.0.1  19.2.0

LSP-ltex-ls/:
ltex-ls-15.2.0

LSP-lua/:
bin           debugger.lua  locale  lua-lang-download  meta    VERSION
changelog.md  LICENSE       log     main.lua           script

LSP-marksman/:
bin  VERSION

LSP-pyright/:
17.3.0  17.6.0  17.9.0  18.10.0  18.3.0  18.7.0  18.9.0  19.0.0  19.1.0  resources
17.5.0  17.8.0  18.1.0  18.11.0  18.6.0  18.8.0  18.9.1  19.0.1  19.2.0

LSP-TexLab/:
linux-x64~v4.1.0

LSP-typescript/:
17.6.0  17.9.0  18.10.0  18.3.0  18.6.0  19.0.1  19.1.0

LSP-yaml/:
17.3.0  17.5.0  17.8.0  18.10.0  18.3.0  18.8.0  19.0.1
17.4.0  17.6.0  17.9.0  18.2.0   18.7.0  18.9.1  19.1.0
rchl commented 1 year ago

Yes, but that's the Node version number, not the server version number. So that number doesn't change when new version of LSP-pyright is released (for example). It changes when new version of Node is installed in your system (or if you are using lsp_utils node instance and that Node instance is updated but that doesn't happen often).

LDAP commented 1 year ago

I see! Misinterpreted that version number.