Skip to content

Create .vscode directory in x.py setup #107703

Closed

Description

@jyn514

Right now, .vscode needs to be configured anew for each workspace and person working on the compiler. We do document the recommended settings in https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc, but it's annoying to have to copy-paste it each time. It would be nice if x setup created those files for you automatically.

Ideally we would even version the config (maybe with a stamp file so it's not in the settings.json file itself) and suggest rerunning x setup in tidy if the config in .vscode gets outdated.

cc https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/False.20error.20report.20for.20.60rust-analyzer.28private-field.29.60 - it might be the case that the settings vary depending on the part of the compiler you're working on? I would really hate for that to be the case, but having per-profile .vscode setup might be one way to make it less painful :/

Activity

  1. added
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
    A-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to Rust
    on Feb 5, 2023
  2. jyn514 commented on Feb 5, 2023

    @jyn514
    MemberAuthor

    I also considered checking .vscode into git, but that doesn't allow people to modify it locally, and doesn't allow the config to be different depending on the profile.

  3. thomcc commented on Feb 5, 2023

    @thomcc
    Member

    I think this is fine so long as x setup prompts the user asking if they want this, with options for yes/no/print, where print just dumps the settings json it wants to add to stdout or whatever.

    And probably if .vscode/settings.json already exists you should just always print instead of trying to modify it in-place (modifying sounds hard since that file allows comments, and i would be pretty mad if they got overwritten).

  4. jyn514 commented on Feb 5, 2023

    @jyn514
    MemberAuthor

    👍 sounds good - we do something like that today for the pre-push hook:

    rust/src/bootstrap/setup.rs

    Lines 375 to 389 in 4aa6afa

    let should_install = loop {
    print!("Would you like to install the git hook?: [y/N] ");
    io::stdout().flush()?;
    input.clear();
    io::stdin().read_line(&mut input)?;
    break match input.trim().to_lowercase().as_str() {
    "y" | "yes" => true,
    "n" | "no" | "" => false,
    _ => {
    eprintln!("error: unrecognized option '{}'", input.trim());
    eprintln!("note: press Ctrl+C to exit");
    continue;
    }
    };
    };

  5. added 2 commits that reference this issue on Feb 8, 2023
    608cdc2
    b16a321
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to RustC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions