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

bootstrap: Consolidate editor setup into ./x setup editor & add support for vim, emacs & helix #131075

Merged
merged 4 commits into from
Oct 6, 2024

Conversation

mrkajetanp
Copy link
Contributor

Add support for automatically setting up the recommended
LSP config for Vim (coc-nvim), Emacs (eglot) and Helix.

Additionally, refactor setup.rs to make it easier to add support
for more editors in the future.

As suggested,
r? @jieyouxu

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Sep 30, 2024
@rustbot
Copy link
Collaborator

rustbot commented Sep 30, 2024

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@rust-log-analyzer

This comment has been minimized.

@mrkajetanp mrkajetanp force-pushed the bootstrap-editors branch 3 times, most recently from fd097d0 to dea665f Compare October 1, 2024 06:35
@mrkajetanp
Copy link
Contributor Author

Should be good now, I ended up with pretty substantial refactoring but I think it's cleaner this way. Returning editor-specific stuff from a method at runtime seems better than holding a ton of static variables on the other end of the file regardless of whether they actually end up being used or not.

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I briefly looked through this and it looks good to me in general, thanks! I'm not a bootstrap reviewer though so I'll hand it off to T-bootstrap reviewers.

src/bootstrap/src/core/build_steps/setup.rs Show resolved Hide resolved
src/bootstrap/src/core/build_steps/setup.rs Outdated Show resolved Hide resolved
src/bootstrap/src/core/build_steps/setup.rs Outdated Show resolved Hide resolved
src/bootstrap/src/core/build_steps/setup.rs Outdated Show resolved Hide resolved
@jieyouxu
Copy link
Member

jieyouxu commented Oct 1, 2024

r? bootstrap

@rustbot rustbot assigned Kobzol and unassigned jieyouxu Oct 1, 2024
Add support for automatically setting up the recommended
LSP config for Emacs.

Additionally, refactor setup.rs to make it easier to add support
for more editors in the future.
Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few nits, but in terms of the bootstrap implementation, it looks fine to me.

I don't use or know any of these IDEs, so it's hard for me to validate the actual functionality though.

Onur has suggested that we might create a subcommand, e.g. x setup editor <editor-name>, given that we now support multiple editors.

Once this is merged, we should also update https://rustc-dev-guide.rust-lang.org/building/quickstart.html?highlight=vscode#quickstart and https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc.

src/bootstrap/src/core/build_steps/setup.rs Outdated Show resolved Hide resolved
src/bootstrap/src/core/build_steps/setup.rs Outdated Show resolved Hide resolved
@Kobzol
Copy link
Contributor

Kobzol commented Oct 3, 2024

When running x setup, it would be nicer to ask the user which IDE they want to preconfigure (if any). After this PR, it will cycle through all four variants. This might be easier to do in combination with introducing a separate editor Step implementation.

Consolidate LSP setup for different editors into one `./x setup editor`.
@mrkajetanp mrkajetanp changed the title bootstrap: Add support for ./x setup [vim|emacs|helix] bootstrap: Consolidate editor setup into ./x setup editor & add support for vim, emacs & helix Oct 3, 2024
@mrkajetanp
Copy link
Contributor Author

Working as intended now. I don't think we can avoid having an Editor struct for the Step separate from EditorKind, looks like putting them together would require a larger rework of the logic given that it's not the same case as with Profile. We can call ./x setup [compiler|library|whatever] but not ./x setup profile while in this case we want to call ./x setup editor but not ./x setup vscode. I think it's probably fine as it's currently structured.

Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I think this is much better.

@onur-ozkan Just to be sure, are you okay with the x setup editor approach?

If yes, this is ready to be merged I think.

match EditorKind::prompt_user() {
Ok(editor_kind) => {
if let Some(editor_kind) = editor_kind {
while !t!(create_editor_settings_maybe(config, editor_kind.clone())) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: The logic would be simpler to follow if the loop was directly inside create_editor_settings_maybe, allowing to print the preview without having to call the function again.

But this was pre-existing, so it doesn't need to be changed in this PR.

@onur-ozkan
Copy link
Member

@onur-ozkan Just to be sure, are you okay with the x setup editor approach?

Looks good to me, thanks for the ping.

@Kobzol
Copy link
Contributor

Kobzol commented Oct 5, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Oct 5, 2024

📌 Commit 456be10 has been approved by Kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 5, 2024
@Kobzol
Copy link
Contributor

Kobzol commented Oct 5, 2024

@mrkajetanp Could you please also update the rustc-dev-guide? :) E.g. here.

@mrkajetanp
Copy link
Contributor Author

Could you please also update the rustc-dev-guide? :)

Will do, no problem! Thanks for the reviews :)

@bors
Copy link
Contributor

bors commented Oct 6, 2024

⌛ Testing commit 456be10 with merge 68301a6...

@bors
Copy link
Contributor

bors commented Oct 6, 2024

☀️ Test successful - checks-actions
Approved by: Kobzol
Pushing 68301a6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 6, 2024
@bors bors merged commit 68301a6 into rust-lang:master Oct 6, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Oct 6, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (68301a6): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.4% [0.4%, 0.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary 2.9%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.9% [2.8%, 3.0%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

Results (primary -2.8%, secondary -3.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.8% [-2.8%, -2.8%] 1
Improvements ✅
(secondary)
-3.5% [-3.5%, -3.5%] 1
All ❌✅ (primary) -2.8% [-2.8%, -2.8%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 774.957s -> 775.25s (0.04%)
Artifact size: 329.49 MiB -> 329.52 MiB (0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants