Shopify / ruby-lsp

An opinionated language server for Ruby
https://shopify.github.io/ruby-lsp/
MIT License
1.52k stars 143 forks source link

Unable to start language server on v0.7.6 #2260

Closed mjohansenwork closed 2 months ago

mjohansenwork commented 2 months ago

Description

I'm running into an error with the latest v0.7.6 version of the extension. It looks like the version was bumped quite recently, as of this commit https://github.com/Shopify/ruby-lsp/commit/35370276b2a6651a0099ba47deda99cf1e90c2d1

This is the error message (found in the VSCode output extension host logs):

Cannot find module 'vscode-languageclient/node'

I installed v0.7.5 and it works.

davidrunger commented 2 months ago

I am seeing the same thing. The "Ruby LSP" VS Code extension is not working at all at version v0.7.6 or v0.7.7 (pre-release). Downgrading to v0.7.5 gets it working again. (Tip: see here for how to downgrade.)

None of the extension's functionality seems to be working (e.g. underlining RuboCop violations, or autocorrecting them when I hit my configured key combination). If I open the VS Code command palette and choose "Ruby LSP: Restart", then I get this error message:

Command 'Ruby LSP: Restart' resulted in an error

command 'rubyLsp.restart' not found

(and likewise for other Ruby LSP commands that I have tried to execute from the command palette, such as stop and start).

I am on Linux (MX Linux / Debian).

In the VS Code "Output" panel, there is no "Ruby LSP" option available in the select/dropdown. If I choose "Extension Host" in the "Output" panel, there is this error (Cannot find module 'vscode-languageclient/node') and stack trace (as mentioned in the initial bug report):

2024-07-05 14:27:02.754 [info] ExtensionService#_doActivateExtension Shopify.ruby-lsp, startup: true, activationEvent: 'workspaceContains:Gemfile.lock'
2024-07-05 14:27:02.788 [error] Activating extension Shopify.ruby-lsp failed due to an error:
2024-07-05 14:27:02.789 [error] Error: Cannot find module 'vscode-languageclient/node'
Require stack:
- /home/david/.vscode/extensions/shopify.ruby-lsp-0.7.7/out/extension.js
- /usr/share/code/resources/app/out/vs/loader.js
- /usr/share/code/resources/app/out/bootstrap-amd.js
- /usr/share/code/resources/app/out/bootstrap-fork.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1055:15)
    at Function.i._resolveFilename (node:electron/js2c/utility_init:2:13405)
    at Module._load (node:internal/modules/cjs/loader:908:27)
    at Function.c._load (node:electron/js2c/node_init:2:13672)
    at Function.S._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:177:6035)
    at Function.n._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:174:31788)
    at Function.i._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:139:34301)
    at Module.require (node:internal/modules/cjs/loader:1122:19)
    at h (/usr/share/code/resources/app/out/vs/loader.js:4:647)
    at Object.<anonymous> (/home/david/.vscode/extensions/shopify.ruby-lsp-0.7.7/out/extension.js:1:780)
    at Module.o._compile (/usr/share/code/resources/app/out/vs/loader.js:4:1271)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1311:10)
    at Module.load (node:internal/modules/cjs/loader:1098:32)
    at Module._load (node:internal/modules/cjs/loader:945:12)
    at Function.c._load (node:electron/js2c/node_init:2:13672)
    at Function.S._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:177:6035)
    at Function.n._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:174:31788)
    at Function.i._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:139:34301)
    at Module.require (node:internal/modules/cjs/loader:1122:19)
    at require (node:internal/modules/helpers:130:18)
    at Function.i [as __$__nodeRequire] (/usr/share/code/resources/app/out/vs/loader.js:5:98)
    at m.xb (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:174:32967)
    at async Promise.all (index 0)

image

vinistock commented 2 months ago

Thanks for reporting! For now, please downgrade to the previous version while we investigate the issue.

Earlopain commented 2 months ago

The extension bundle is not bundled right, 1.6k vs the 15k lines of code is was previously. I suspect this esbuild issue to be highly relevant. https://github.com/evanw/esbuild/issues/3819. I'd try bumping esbuild to 0.23 or downgrading to 0.21

vinistock commented 2 months ago

That would explain why a runtime dependency is suddenly missing without us changing anything in the package.json declarations.

I'll try upgrading.

vinistock commented 2 months ago

Yeah, upgrading fixes the bundling issues. @Earlopain thank you so much for the pointer, this was extremely helpful.

https://github.com/Shopify/ruby-lsp/pull/2261 will fix it and I'll cut releases for both stable and preview momentarily.

vinistock commented 2 months ago

Alright, v0.7.8 stable and v0.7.9 preview are published and should auto-upgrade as soon as they become available in the marketplace, which typically takes a few minutes.

Thanks for reporting everybody!

davidrunger commented 2 months ago

I can confirm that v0.7.8 and v0.7.9 are both working for me in VS Code. :+1: Thank you for the super quick fix @vinistock and for the pointer to the problem and solution @Earlopain !