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

Launching server using command "racket" failed. #131

Closed
johnthompson-ybor opened this issue Nov 19, 2024 · 10 comments
Closed

Launching server using command "racket" failed. #131

johnthompson-ybor opened this issue Nov 19, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@johnthompson-ybor
Copy link

Environment

  • OS: MacOs

  • OS Version [e.g. Catalina]

  • VS Code Version [e.g. 1.46.1]

  • Racket version [e.g. 7.7]

    • run: racket -v

    Welcome to Racket v8.15 [cs].

  • Racket Langserver checksum [e.g. 64c1827548089c97c56a53a90ef3d569deb0e6c2]

    • run: raco pkg show --full-checksum racket-langserver

    raco pkg show --full-checksum racket-langserver
    Installation-wide:
    [none]
    User-specific for installation "8.15":
    Package Checksum Source
    racket-langserver 7481d2f98f175a545a0714ead3ec20ae327afec4 catalog...erver.git
    v0.6.7

  • Magic Racket version [e.g. 0.5.6]

Error message

[Error - 4:20:59 PM] Starting client failed
Launching server using command "racket" failed.

I've tried hardcoding the path, it doesn't make any difference. I can run racket and langserver and racket --lib racket-langserver just fine from the terminal. There's no more useful debug information beyond that in anything I can find.

@johnthompson-ybor johnthompson-ybor added the bug Something isn't working label Nov 19, 2024
@jryans
Copy link
Collaborator

jryans commented Nov 20, 2024

It seems like you skipped a few of the environment questions above...? Please fill them in so we have the full context on your situation.

@ilyapoz
Copy link

ilyapoz commented Nov 24, 2024

Same for me.

Environment

  • OS: MacOS
  • OS Version Sonoma 14.4.1
  • VS Code 1.95.3
  • Racket version v 8.15 from homebrew.
  • Racket Langserver checksum 7481d2f98f175a545a0714ead3ec20ae327afec4
  • Magic Racket version v0.6.7

Error message

[Error - 20:47:22] Starting client failed
Launching server using command racket failed.

Additional context

First intstallation. DrRacket works fine, tried to move to vscode, found magic racket, everything executes in the terminal, but lsp does not work.

@ilyapoz
Copy link

ilyapoz commented Nov 24, 2024

devconsole

notificationsAlerts.ts:42 Couldn't start client Racket Language Client
c @ notificationsAlerts.ts:42
log.ts:439   ERR spawn racket ENOENT: Error: spawn racket ENOENT
	at ChildProcess._handle.onexit (node:internal/child_process:286:19)
	at onErrorNT (node:internal/child_process:484:16)
	at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
console.ts:137 [Extension Host] rejected promise not handled within 1 second: Launching server using command racket failed.
uGi @ console.ts:137
log.ts:439   ERR Launching server using command racket failed.

@jryans
Copy link
Collaborator

jryans commented Dec 2, 2024

Hmm, so far I am not able to reproduce this issue.

I am testing on a similar system configuration:

  • macOS 14.7.1
  • VS Code 1.95.3
  • Racket 8.15
  • Racket Langserver 7481d2f98f175a545a0714ead3ec20ae327afec4
  • Magic Racket 0.6.7

These errors strongly suggest that the racket command is not accessible to VS Code somehow, but you've both said it works fine in the terminal...

Have you tried restarting VS Code just for good measure...? (Perhaps it's caching old binary paths...)

@ilyapoz
Copy link

ilyapoz commented Dec 7, 2024

Restarting did not help me. In my case racket is installed via homebrew if that matters brew install --cask racket

@ilyapoz
Copy link

ilyapoz commented Dec 7, 2024

Is there some diagnostic command we can try? In devtools or otherwise?

@jryans
Copy link
Collaborator

jryans commented Dec 7, 2024

I also used Homebrew to install Racket via the cask.

One possible difference is that I am using an Intel Mac, while you may have Apple Silicon... though so far, I can't think of why that would matter here.

It's hard to know quite what to debug... The extension retrieves the LSP command and arguments from settings:

const command = vscode.workspace
.getConfiguration("magicRacket.languageServer")
.get<string>("command");
const args = vscode.workspace
.getConfiguration("magicRacket.languageServer")
.get<string[]>("arguments");

and then passes them to the LSP client, which tries to run the command:

langClient = new LanguageClient(
"magicRacket",
"Racket Language Client",
serverOptions,
clientOptions,
);

The actual process launch is handled by the LSP client code.

What do you have magicRacket.languageServer.command and magicRacket.languageServer.arguments set to...? If you put those values together in a terminal and try to run it, that should be effectively the same as what the extension is doing.

@ilyapoz
Copy link

ilyapoz commented Dec 8, 2024

tl;dr

"magicRacket.languageServer.command": "/opt/homebrew/bin/racket",

fixes the problem in my case. I think previously I tried setting magicRacket.general.racketPath only and that did not (obviously now) help.

To debug I created a python script on my machine and pointed the setting above to it and somehow homebrew bin is not in the PATH.

I guess homebrew sets PATH in some rc file that is not being sourced in the vscode plugins or whatnot. So most certainly not an issue with magicRacket.

I was able to format my files! Yay! 🎉 Thanks for the plugin, btw, using it to read SICP, much more fun than any other env.

@jryans
Copy link
Collaborator

jryans commented Dec 9, 2024

Ah okay, glad you got it working! @johnthompson-ybor, maybe your issue is similar?

I will look into a better error message for this case, or perhaps displaying these values in context.

@jryans
Copy link
Collaborator

jryans commented Dec 11, 2024

Filed #132 to improve the error message in the future.

No reply from the OP, so let's assume this is resolved for now.

@jryans jryans closed this as completed Dec 11, 2024
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

No branches or pull requests

3 participants