-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
RA ignores vscode settings in multiroot workspace #17810
Comments
That's a VS Code warning, and not something that we display. We probably don't even see the settings.
|
Note that we run a single rust-analyzer instance per VSCode window, so configs set by the client will always apply globally so this technically works as expected. |
OK. So it sounds like currently rust-analyzer doesn't support vscode multiroot workspaces then? If that's the case, could we turn this issue into a feature request to add support for multiroot workspaces in vscode? |
It does support Code workspaces, it doesn't support project-specific settings, especially not those that Code doesn't even read. |
It looks like rust-analyzer doesn't see |
I would expect the client config of the workspace folder itself to work (that is where you have the workspace defined) |
Thanks. You are correct. I can add
{
"folders": [
{
"path": "."
},
{
"path": "sub"
}
],
"settings": {
"rust-analyzer.check.overrideCommand": [
"blah I am in the code-workspace file"
]
}
} The downside, of course, is this uses the same rust-analyzer settings for both workspace roots, which defeats the purpose of using a multiroot workspace in the first place. My goal is:
However, I cannot get RA to use different settings in this configuration. Maybe this is just a new feature request I'm asking for. Can RA be made to support vscode multiroot workspaces so that RA in separate vscode workspace roots sees different settings? |
It is unlikely we'll be able to support this. It would require us to spawn a rust-analyzer per vscode workspace folder which is more resource heavy (as we can't share state between the multiple processes) and I am also not even sure whether VSCode allows us to do this nicely (I feel like I looked into this before where trying to spawn multiple clients caused a bunch of issues). Generally speaking I'd prefer for us to not do that. |
Could we support different configs for the Code workspace members within a single server instead? |
Maybe? That would probably require an lsp extension and a bunch of extra stuff on the vscode extension side though |
For reading the settings? We could read them only from rust-analyzer.toml. But it does seem like a bit of a pain. |
Well for feeding |
Today the only workaround I've found is to open two separate vscode windows, one in the main root "." and another vscode window for "sub" (see the example in the OP). I believe this would result in two separate rust-analyzers running as well. I'd be happy to try using |
Maybe, maybe not. What is your definition of "ready" here, I guess?
I don't recall if it does right now, but the design intention of |
rust-analyzer version: rust-analyzer version: 0.3.2062-standalone (c9109f2 2024-08-04)
rustc version: rustc 1.80.0 (051478957 2024-07-21)
editor or extension: VSCode on macOS
relevant settings: Nothing special. All defaults.
repository link (if public, optional): Here's a small repro repository: https://github.com/devjgm/multiroot
code snippet to reproduce:
The problem is that I have a repo with two areas (directories) where rust-analyzer needs to be configured differently. For example, each directory needs to use a different
"rust-analyzer.check.overrideCommand"
. Since these rust-analyzer settings are specified in the.vscode/settings.json
file in the root of each workspace (vscode workspace, not cargo workspace), I'm trying to use vscode's "multiroot workspaces" to make this work.I define the vscode multiroot workspace like this:
but when I do this vscode says:
for all of rust-analyzer's settings in my
.vscode/settings.json
files. See the screenshot below. The observed behavior also seems to suggest that rust-analyzer's settings are not being applied.Questions
Related
This seems related to #1104, but the final command and resolution on that issue suggests something about
linkedProjects
, which doesn't really help. Again, the goal is to use different rust-analyzer settings in each of vscode's "multiroot" workspaces.The text was updated successfully, but these errors were encountered: