crystal-lang-tools/vscode-crystal-lang

Crystalline server crashes if VSCode started with shortcut

Timecrash opened this issue · 6 comments

Describe the bug
I use Crystalline as my language server, as Scry is now depreciated. Similar to #14, Crystalline crashes in VSCode if started through a desktop shortcut, but works fine if started through the code CLI command.

To Reproduce
Steps to reproduce the behavior:

  1. Start VSCode through desktop shortcut.
  2. See error.

Expected behavior
Crystalline should work normally.

Piece of Code
n/a

Screenshots
Screenshot_20231103_104733

Desktop (please complete the following information):

  • OS: Arch Linux (also seen on Windows 11 and MacOS)
  • Crystal version: 1.10.1
  • This plugin version: 0.8.4

Additional context
I'm not sure if this is a bug in this extension, or Crystalline itself.

Can you let me know if this is still happening with v0.9.0?

Unfortunately it's still broken for me (at least on WSL, haven't tried on Linux/macOS yet).

[Crystal] loading lsp /home/matt/Projects/bin/crystalline
[Error - 12:56:06 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 12:56:06 PM] Connection to server got closed. Server will restart.
true
[Error - 12:56:06 PM] Crystal Language client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:56:07 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 12:56:07 PM] Connection to server got closed. Server will restart.
true
[Error - 12:56:07 PM] Crystal Language client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:56:07 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 12:56:07 PM] Connection to server got closed. Server will restart.
true
[Error - 12:56:07 PM] Crystal Language client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:56:07 PM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:56:07 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 12:56:07 PM] Connection to server got closed. Server will restart.
true
[Error - 12:56:07 PM] Crystal Language client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:56:07 PM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:56:07 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:56:07 PM] The Crystal Language server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 12:56:07 PM] Crystal Language client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:56:07 PM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 

@elbywan Do you know what could be causing this issue? Could the extension be calling crystalline incorrectly / crystalline not handling all the ways vscode is calling it?

Hey @nobodywasishere 👋

Do you know what could be causing this issue? Could the extension be calling crystalline incorrectly / crystalline not handling all the ways vscode is calling it?

I have no idea, sorry 😕 . crystalline is a simple LSP server binary which reads from stdin and writes to stdout.

Maybe starting the IDE through a shortcut is missing some (crystal?) environment variables which are inherited when booting from the terminal?

If crystalline crashes then an error should show up there - under the Crystal entry:

Capture d’écran 2024-02-24 à 19 36 33

I had a thought to try loading Crystalline using VSCode's built-in terminal, and received this error:

$ crystalline
2024-05-01T14:17:00.234684Z  ERROR - lsp: Error executing process: 'crystal': No such file or directory
???
???
???
???
???
src/env/__libc_start_main.c:95:2 in 'libc_start_main_stage2'
Error executing process: 'crystal': No such file or directory (File::NotFoundError)
  from ???
  from ???
  from ???
  from ???
  from ???
  from src/env/__libc_start_main.c:95:2 in 'libc_start_main_stage2'

This was in the Crystal project directory. Maybe this is related? I should note this is through a WSL install, so that might be weird.

I do think there's some issue with launching VSCode through a shortcut. On Mac/Linux, if I launch VSCode from the command line, the extension works fine.

Hi!

I had the exact same issue as @Timecrash, as I mentioned in a Crystalline issue earlier today, except native linux with flatpak.

The issue seems to stem from the way both flatpak and WSL handle access to files. Using a native (non-flatpak) version of VSCodium works correctly.