You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have addressed the issue, but I became aware of the following behavior.
In a yarn monorepo with doom-emacs editor (LSP and such installed properly) I open main.rs in the following directory structure
.git/
package.json
packages/
an-unrelated-package/
<contents not relevant>
apps/
an-unrelated-js-app/
<contents not relevant>
an-example-rust-application/
Cargo.toml
src/
main.rs
In this the rust-analyzer LSP provided me the following error: LSP :: rust-analyzer failed to discover workspace
It is possible to force it to identify the workspace. However I am unaware of exact ways to force it to reliably find the workspace without human intervention.
Workaround:
When opening the file or maybe files at that directory level for the first time, I am prompted by the following interactive message.
main.rs is not part of any project
i ==> import project root path/to/the/root/directory/of/the/git/repo/
I ==> import the project interactively
. ==> import the project at the current directory /apps/an-example-rust-application/src
d ==> do not ask again for the current project by adding /path/to/the/git/repo to lsp-session-folder blacklist
D ==> do not ask again by asking the ignore path interactively
n ==> Do nothing: ask again when opening other files from this project
In the first launch only you can use I to correct this. Otherwise move the thing and you'll have another shot. Given that it can save the directory somewhere there is a way somehow to remove that state without moving the directory, but I am not a nerd and cannot tell you.
Perhaps its naiive, but it seems strange that it cannot find this specific instance of Cargo.toml. It is exactly where it would expect it to be relative to the files. It is only abnormal in its relationship to the .git repo.
Here is a minimally reproducible repo for the interested. Its also quite likely that this is related to the stack and not the tool individually (rustic + doom emacs + LSP-mode + rust-analyzer). Given this I have a few open questions.
Where is state saved for rust-analyzer? Is it saved? and where are configuration values read from?
How would I go about making it so it rust-analyzer looks recursively upwards for the Cargo.toml and if such a solution was implemented would y'all have interest in the contribution?
The text was updated successfully, but these errors were encountered:
r-a saves no state currently. Config files are dependent on the language client you are using. r-a currently only looks at the root folder and the first children for Cargo.toml files, see #13226. The reason for that is performance, as we do not want to currently scan the entire folder hierarchy for projects.
Workaround is in issue body. I'm comfortable with this being closed with a "won't do." A good reason for not doing anything is provided by @Veykril. This 'issue' can be further acted on within the language servers I use and isn't within the context of this project.
I have addressed the issue, but I became aware of the following behavior.
In a yarn monorepo with doom-emacs editor (LSP and such installed properly) I open
main.rs
in the following directory structureIn this the rust-analyzer LSP provided me the following error:
LSP :: rust-analyzer failed to discover workspace
It is possible to force it to identify the workspace. However I am unaware of exact ways to force it to reliably find the workspace without human intervention.
Workaround:
When opening the file or maybe files at that directory level for the first time, I am prompted by the following interactive message.
In the first launch only you can use
I
to correct this. Otherwise move the thing and you'll have another shot. Given that it can save the directory somewhere there is a way somehow to remove that state without moving the directory, but I am not a nerd and cannot tell you.Perhaps its naiive, but it seems strange that it cannot find this specific instance of Cargo.toml. It is exactly where it would expect it to be relative to the files. It is only abnormal in its relationship to the .git repo.
Here is a minimally reproducible repo for the interested. Its also quite likely that this is related to the stack and not the tool individually (rustic + doom emacs + LSP-mode + rust-analyzer). Given this I have a few open questions.
rust-analyzer
? Is it saved? and where are configuration values read from?The text was updated successfully, but these errors were encountered: