Skip to content
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

Create .vscode directory in x.py setup #107703

Closed
jyn514 opened this issue Feb 5, 2023 · 4 comments · Fixed by #107757
Closed

Create .vscode directory in x.py setup #107703

jyn514 opened this issue Feb 5, 2023 · 4 comments · Fixed by #107757
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jyn514
Copy link
Member

jyn514 commented Feb 5, 2023

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 :/

@jyn514 jyn514 added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself labels Feb 5, 2023
@jyn514
Copy link
Member Author

jyn514 commented Feb 5, 2023

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.

@thomcc
Copy link
Member

thomcc commented Feb 5, 2023

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).

@jyn514
Copy link
Member Author

jyn514 commented Feb 5, 2023

👍 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;
}
};
};

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 8, 2023
…yn514

Allow automatically creating vscode `settings.json` with `x setup`

Closes rust-lang#107703
@bors bors closed this as completed in b16a321 Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants