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

"connection to server is erroring. Header must provide a Content-Length property” errors in VS Code #6744

Open
snej opened this issue May 12, 2024 · 6 comments

Comments

@snej
Copy link

snej commented May 12, 2024

  • Installed Roc nightly on my MacBook Pro
  • Installed the VS Code extension
  • Opened a VS code window, pasted in the first “Building An Application” tutorial example, and saved it as “hello.roc"
  • Several error notifications popped up:

Client roc-lang: connection to server is erroring. Header must provide a Content-Length property. {"downloading \u001b[36mhttps":"//github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br\u001b[0m\n into /Users/snej/.cache/roc/packages\n\nContent-Length: 38"} Shutting down server.

Client roc-lang: connection to server is erroring. Header must provide a Content-Length property. {"{\"jsonrpc\"":"\"2.0\",\"result\":null,\"id\":1}Content-Length: 38"} Shutting down server.

Client roc-lang: connection to server is erroring. Header must provide a Content-Length property. {"{\"jsonrpc\"":"\"2.0\",\"result\":null,\"id\":2}Content-Length: 157"} Shutting down server.

The text in the editor does have colors, though, so I assume the language server is running now.

@snej
Copy link
Author

snej commented May 12, 2024

Roc version is "roc nightly pre-release, built from commit dd9a6ff on Sat May 11 09:12:29 UTC 2024”

VS Code is Version: 1.85.0

@Anton-4
Copy link
Contributor

Anton-4 commented May 13, 2024

Hi @snej,
Did you set Roc-lang › Language-server: Exe in the settings of the extension?
For me it is set to /Users/admin/Downloads/temp2/roc_nightly-macos_apple_silicon-2024-05-13-e5ea6dc4617/roc_language_server.
We mention it but it's easy to look over, I'll look into improving this.

@Anton-4
Copy link
Contributor

Anton-4 commented May 13, 2024

@Anton-4
Copy link
Contributor

Anton-4 commented May 13, 2024

The text in the editor does have colors, though, so I assume the language server is running now.

That will work without the language server. If you introduce an error in to the code, e.g by changing Stdout.line to Stdout.lin and the error is underlined in red, the language server is working.

@snej
Copy link
Author

snej commented May 13, 2024

Yes, I entered the path to the language server.

If you look closely at the error, it looks as though the language server is echoing some compiler status output (about downloading a package) to the HTTP response stream before the response headers are complete, and only afterwards sends the Content-Length header. Perhaps that output is being redirected to the wrong FD?

Client roc-lang: connection to server is erroring. Header must provide a Content-Length property. {"downloading \u001b[36mhttps":"//github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br\u001b[0m\n into /Users/snej/.cache/roc/packages\n\nContent-Length: 38"} Shutting down server.

@Anton-4
Copy link
Contributor

Anton-4 commented May 13, 2024

Hmm, what seems wrong to me is that {"downloading \u001b[36mhttps":"//github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br\u001b[0m\n into /Users/snej/.cache/roc/packages\n\nContent-Length: 38"} is not the json we want. Content-Length is not a separate json field, it's just concatenated with the other value string.

Can you try updating to the latest vscode (1.89)? That version works on my mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants