rust-lang / rust-lang/rust-analyzer

RA ignores vscode settings in multiroot workspace

Open
#17,810 20 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: rust-analyzer version: 0.3.2062-standalone (c9109f23d 2024-08-04)

rustc version: rustc 1.80.0 (051478957 2024-07-21)

editor or extension: VSCode on macOS

Version: 1.92.0
Commit: b1c0a14de1414fcdaa400695b4db1c0799bc3124
Date: 2024-07-31T23:26:45.634Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.6.0

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:

{
    "folders": [
        {
            "path": "."
        },
        {
            "path": "sub"
        }
    ],
}

but when I do this vscode says:

This setting cannot be applied in this workspace. It will be applied when you open the containing workspace folder directly.

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.

image

Questions

  • Is this a bug that should work today?
  • Am I simply configuring something wrong?
  • Is this a new feature that you're considering adding?

Related

This seems related to https://github.com/rust-lang/rust-analyzer/issues/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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with the linked multiroot repository and inspect each folder's .vscode/settings.json alongside the shown VSCode multiroot workspace configuration. Compare how rust-analyzer settings are read in a single-folder workspace versus the multiroot case, and review related issue #1104. Done means the intended per-folder settings behavior is established and supported, or the limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.