Skip to content

Failed to load workspace when launching via cursor instead of cursor . #17953

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

Closed
rikhuijzer opened this issue Aug 24, 2024 · 4 comments
Closed
Labels
C-bug Category: bug

Comments

@rikhuijzer
Copy link
Contributor

rust-analyzer version: 0.3.1958-standalone

rustc version: rustc 1.80.1 (3f5fd8dd4 2024-08-06)

editor or extension: Cursor (VSCode) with extension version 0.3.1958

repository link (if public, optional): (eg. rust-analyzer)

When I open the Cursor editor via the terminal via cursor . (same as vscode .) in a specific project directory, rust-analyzer works.

However, when I open the Cursor editor without specifying the workspace via ., then rust-analyzer fails even though my folders show the same project as it would be cursor .. The error is

2024-08-24T17:36:51.874219Z ERROR rust_analyzer::main_loop: FetchWorkspaceError:
rust-analyzer failed to load workspace: Failed to load the project at /Users/rik/git/xxx/Cargo.toml: Failed to query rust toolchain version at /Users/rik/git/xxx, is your toolchain setup correctly?: cd "/Users/rik/git/xxx" && "cargo" "--version" failed: No such file or directory (os error 2)

So the weird thing here is that the correct file is specified in the command, but still it fails. Possibly related is that my default shell is fish. If I copy the command, it shows an error:

$ ~/g/xxx (main)> cd /Users/rik/git/xxx/ & cargo --version
cargo 1.80.1 (376290515 2024-07-16)

fish: Job 1, 'cd /Users/rik/git/rrcf/ &' has ended

So that rust-analyzer fails makes sense, but then why does it succeed when using cursor .?

It is possible that this behavior is as expected. Feel free to close the issue if so. I couldn't find any useful tip while searching for 20 minutes so I thought it would probably be good to write this down somewhere.

@rikhuijzer rikhuijzer added the C-bug Category: bug label Aug 24, 2024
@lnicola
Copy link
Member

lnicola commented Aug 27, 2024

Just to make sure, are you starting cursor from the terminal, or from a menu entry / shortcut?

Both work for me, and I'm using fish. Can you also test in VS Code?


If I copy the command, it shows an error

That's because you have a & instead of &&. But I don't think we run cd, that's just a way of showing that we run cargo --version from inside /Users/rik/git/xxx.

@rikhuijzer
Copy link
Contributor Author

rikhuijzer commented Aug 28, 2024

Just to make sure, are you starting cursor from the terminal, or from a menu entry / shortcut?

Good question. It looks like if I start it via the MacOS spotlight search, then it fails and if I start from the terminal, then it works (although I think a few days ago it also failed via the terminal).

@truell20, maybe this is a known issue at your side?

@lnicola
Copy link
Member

lnicola commented Aug 28, 2024

If your editor can’t find the binary even though the binary is on your $PATH, the likely explanation is that it doesn’t see the same $PATH as the shell, see this issue. On Unix, running the editor from a shell or changing the .desktop file to set the environment should help.

Well, non-MacOS Unix.

@rikhuijzer
Copy link
Contributor Author

You are absolutely right! Thanks. That's probably the issue.

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

No branches or pull requests

2 participants