Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EINVAL, Couldn't create connection to server when using vscode extension #7231

Open
JohnLozier opened this issue Jan 3, 2025 · 6 comments · Fixed by #7239
Open

EINVAL, Couldn't create connection to server when using vscode extension #7231

JohnLozier opened this issue Jan 3, 2025 · 6 comments · Fixed by #7239
Labels
🐛 bug Something isn't working

Comments

@JohnLozier
Copy link

JohnLozier commented Jan 3, 2025

I tried this:

I am trying to use the vscode extension for wing, but it immediately crashes.

I have already tried:

  • Installing 0.85.34 (winglang)
  • Installing previous versions of the extension
  • Installing on IntelliJ (also crashed)
  • Installing winglang with pnpm and npm
  • Manually setting path in extension settings
  • Running on multiple windows devices

Running wing lsp doesn't throw any errors, but also doesn't print anything (not sure if this is intended)

This happened:

Here is the vscode logs:

Wing Language Server client: couldn't create connection to server.
Error: spawn EINVAL
	at ChildProcess.spawn (node:internal/child_process:420:11)
	at Object.spawn (node:child_process:796:9)
	at c:\Users\username\.vscode\extensions\monada.vscode-wing-0.85.33\lib\extension.js:17778:40
	at async LanguageClient2.createConnection (c:\Users\username\.vscode\extensions\monada.vscode-wing-0.85.33\lib\extension.js:15795:28)
	at async LanguageClient2.start (c:\Users\username\.vscode\extensions\monada.vscode-wing-0.85.33\lib\extension.js:15371:30)
	at async LanguageServerManager.start (c:\Users\username\.vscode\extensions\monada.vscode-wing-0.85.33\lib\extension.js:18109:5)
	at async wingBinChanged (c:\Users\username\.vscode\extensions\monada.vscode-wing-0.85.33\lib\extension.js:18209:9)
	at async activate (c:\Users\username\.vscode\extensions\monada.vscode-wing-0.85.33\lib\extension.js:18242:3)
	at async K0.n (file:///c:/Users/username/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:115:4447)
	at async K0.m (file:///c:/Users/username/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:115:4410)
	at async K0.l (file:///c:/Users/username/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:115:3866)

I expected this:

No response

Is there a workaround?

No response

Anything else?

No response

Wing Version

0.85.35

Node.js Version

v20.16.0

Platform(s)

Windows

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@JohnLozier JohnLozier added the 🐛 bug Something isn't working label Jan 3, 2025
@ofiesh
Copy link

ofiesh commented Jan 6, 2025

I've been chatting about this in the Discord thread, but I was able to get this working with the shell: true option.

In Windows there appears to be a security restriction that, without the option, node will error with EINVAL.

I hacked the installed plugin to add the option and the wing extension worked:

            const options = Object.assign({}, command.options);
            options.shell = true;
            options.cwd = options.cwd || serverWorkingDir;
            if (transport === void 0 || transport === TransportKind.stdio) {
              const serverProcess = cp.spawn(command.command, args, options);

That being said, I have no idea in what repo or file this change would need to be made, or how you'd want to identify when that option needs to be added.

@JohnLozier
Copy link
Author

Thanks for your help, that seems like the issue.

Gonna keep the issue up until this gets merged (hopefully soon). I'm also not sure how this should be added, but the effective file is here.

Manually changing it should be fine as a temporary fix.

@skyrpex
Copy link
Contributor

skyrpex commented Jan 7, 2025

The affected code seems to belongs to https://github.com/microsoft/vscode-languageserver-node, more specifically here.

I believe we can configure the shell option without altering the original source. Will keep you posted.

skyrpex added a commit that referenced this issue Jan 7, 2025
Define `shell: true` in the options used to spawn the language server.

Fixes #7231.
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.85.41.

@skyrpex
Copy link
Contributor

skyrpex commented Jan 9, 2025

Still an issue.

@skyrpex skyrpex reopened this Jan 9, 2025
@skyrpex
Copy link
Contributor

skyrpex commented Jan 10, 2025

The vscode extension v0.85.44 now includes the fix suggested by @ofiesh. I'd appreciate if you could try it again 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants