lifeart / vscode-ember

VSCode client for the Ember Language Server
https://marketplace.visualstudio.com/items?itemName=lifeart.vscode-ember-unstable
Other
30 stars 9 forks source link

Uncaught error - Connection got disposed #42

Open andrew-paterson opened 1 year ago

andrew-paterson commented 1 year ago

I see the above error in the runtime status tab for the extension settings, and it seems that the language server is nt starting up.

No linting hints are showing up in my template files. I have confirmed that running npm run lint:hbs:fix from my project directory works.

I've also tried with only one Ember project in a workspace and the same issue occurred.

Ubuntu 22.04.2 LTS


Commit: 7f329fe6c66b0f86ae1574c2911b681ad5a45d63
Date: 2023-03-29T10:05:35.165Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Linux x64 5.19.0-38-generic
Sandboxed: No```
lifeart commented 1 year ago

Hi @andrew-paterson! Thank you for report! Could you specify:

Project details:

Project structure:

andrew-paterson commented 1 year ago

My apologies some data was missing above.

vsCode version 1.77.0 UELS version v3.0.48

Project details

Ember version 3.28 ember-template-lint version 3.16.0 There are no in-repo addons or in-repo engines.

Project structure

There is only 1 ember project in the repo. The ember app is at the root of the repo. npm is used for package management, via Node version manager. I've tried both with linked packages and without. Sometimes I also have nested linked packages.

lifeart commented 1 year ago

@andrew-paterson thank you for details!

Could you send output of this window:

image
andrew-paterson commented 1 year ago

Hi @lifeart

Thank you!

Here it is. In case it helps, /home/paddy/test/monolith is the path to an Elixir project, not an Ember project.

"Initializing Ember Language Server at /home/paddy/test/monolith"
[Info  - 18:04:59] UELS: executeInitializers
To run Ember locally, please first run  export EMBER_SERVE=true
[Info  - 18:05:00] Ember CLI project added at /home/paddy/test/test-ember-assets
[Info  - 18:05:01] Connection to server got closed. Server will restart.
[Error - 18:05:01] Request workspace/executeCommand failed.
Error: Connection got disposed.
    at Object.dispose (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:62879)
    at Object.dispose (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:142962)
    at w.handleConnectionClosed (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:143175)
    at w.handleConnectionClosed (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:203521)
    at t (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:141264)
    at r.invoke (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:64492)
    at o.fire (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:65253)
    at Y (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:52137)
    at r.invoke (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:64492)
    at o.fire (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:65253)
    at d.fireClose (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:73134)
    at ChildProcess.<anonymous> (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:84095)
    at ChildProcess.emit (node:events:538:35)
    at maybeClose (node:internal/child_process:1092:16)
    at Socket.<anonymous> (node:internal/child_process:451:11)
    at Socket.emit (node:events:526:28)
    at Pipe.<anonymous> (node:net:687:12)
[Error - 18:05:01] Request workspace/executeCommand failed.
Error: Connection got disposed.
    at Object.dispose (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:62879)
    at Object.dispose (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:142962)
    at w.handleConnectionClosed (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:143175)
    at w.handleConnectionClosed (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:203521)
    at t (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:141264)
    at r.invoke (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:64492)
    at o.fire (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:65253)
    at Y (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:52137)
    at r.invoke (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:64492)
    at o.fire (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:65253)
    at d.fireClose (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:73134)
    at ChildProcess.<anonymous> (/home/paddy/.vscode/extensions/lifeart.vscode-ember-unstable-3.0.48/dist/node/client/nodeClientMain.js:1:84095)
    at ChildProcess.emit (node:events:538:35)
    at maybeClose (node:internal/child_process:1092:16)
    at Socket.<anonymous> (node:internal/child_process:451:11)
    at Socket.emit (node:events:526:28)
    at Pipe.<anonymous> (node:net:687:12)
[Info  - 18:05:02] lazy init enabled, waiting for config from VSCode
"Initializing Ember Language Server at /home/paddy/test/monolith"
lifeart commented 1 year ago

It looks like server is going mad right after this line:

[Info  - 18:05:00] Ember CLI project added at /home/paddy/test/test-ember-assets

If we temporary remove this folder (/home/paddy/test/test-ember-assets) is all works fine?

andrew-paterson commented 1 year ago

I've tracked down the issue via the output tab. One or two ember projects run process.exit and thus stop the ember server if a certain environment variable is not set, or if the post is not set to a specific number.

Is it possible to have the UELS run a command like export FOO=bar before it runs ember serve?

lifeart commented 1 year ago

@andrew-paterson, you mean inside ember-cli-build.js there is smf is exiting process?

There is few possible solutions:

  1. Ignore this ember project (in config)
  2. Create els addon and implement init hook (https://github.com/lifeart/ember-language-server/blob/component-context-info-origin/src/project.ts#L208)
  3. Modify ember-cli-build.js to not fail

In scope of this conversation https://github.com/lifeart/ember-language-server/issues/342

image

We agreed on environment name, specified by language server to be able to detect inside ember-cli-build is it executed by ls or ember-cli, if it may be a case - let me know, it's relatively simple to ship

andrew-paterson commented 1 year ago

Thank you, that clarifies things.

I can definitely find a sane workaround based on those 3 options.

lifeart commented 1 year ago

@andrew-paterson let me know if I can help you somehow, also, if issue may be fixed if uELS introduce it's own env variable (EMBER_LANGUAGE_SERVER) - I could simply add it

andrew-paterson commented 1 year ago

Would that allow me to set custom env vars inside that? Another option would be if the settings could allow commands to be specified to run on the environment before ember serve.

lifeart commented 1 year ago

@andrew-paterson uELS does not run ‘ember serve’ command, it’s only loads config/environment.js file

andrew-paterson commented 1 year ago

@lifeart, I found a good workaround to avoid the need for ENV vars before loading the environment file. It would be good to be able to set those though.

lifeart commented 1 year ago

@andrew-paterson in general, we need environment.js file only for podModulePrefix, and it seems easier to allow users specify it manually for projects, or allow to disable such discovery case. One more option - is just get value using AST parsing.