Skip to content

Commit 0785ab9

Browse files
authored
Unrolled build for rust-lang#139843
Rollup merge of rust-lang#139843 - thaliaarchi:editor-file-associations, r=Mark-Simulacrum Setup editor file associations for non-rs extensions .gitattributes lists `*.fixed`, `*.pp`, and `*.mir` as file extensions which should be treated as Rust source code. Do the same for VS Code and Zed. This only does syntax highlighting, which is appropriate, as MIR isn't really Rust code. At the same time, consistently order `rust-analyzer.linkedProjects` between editors. For some reason, Eglot didn't include `library/Cargo.toml`. I have tested this with VS Code and Zed. I have not implemented it for Emacs/Eglot or Helix.
2 parents 077cedc + d1e82ba commit 0785ab9

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

src/bootstrap/src/core/build_steps/setup.rs

+3
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ Select which editor you would like to set up [default: None]: ";
584584
"51068d4747a13732440d1a8b8f432603badb1864fa431d83d0fd4f8fa57039e0",
585585
"d29af4d949bbe2371eac928a3c31cf9496b1701aa1c45f11cd6c759865ad5c45",
586586
"b5dd299b93dca3ceeb9b335f929293cb3d4bf4977866fbe7ceeac2a8a9f99088",
587+
"631c837b0e98ae35fd48b0e5f743b1ca60adadf2d0a2b23566ba25df372cf1a9",
587588
],
588589
EditorKind::Helix => &[
589590
"2d3069b8cf1b977e5d4023965eb6199597755e6c96c185ed5f2854f98b83d233",
@@ -602,10 +603,12 @@ Select which editor you would like to set up [default: None]: ";
602603
"4eecb58a2168b252077369da446c30ed0e658301efe69691979d1ef0443928f4",
603604
"c394386e6133bbf29ffd32c8af0bb3d4aac354cba9ee051f29612aa9350f8f8d",
604605
"e53e9129ca5ee5dcbd6ec8b68c2d87376474eb154992deba3c6d9ab1703e0717",
606+
"f954316090936c7e590c253ca9d524008375882fa13c5b41d7e2547a896ff893",
605607
],
606608
EditorKind::Zed => &[
607609
"bbce727c269d1bd0c98afef4d612eb4ce27aea3c3a8968c5f10b31affbc40b6c",
608610
"a5380cf5dd9328731aecc5dfb240d16dac46ed272126b9728006151ef42f5909",
611+
"2e96bf0d443852b12f016c8fc9840ab3d0a2b4fe0b0fb3a157e8d74d5e7e0e26",
609612
],
610613
}
611614
}

src/etc/rust_analyzer_eglot.el

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
"check"
99
"--json-output"])
1010
:linkedProjects ["Cargo.toml"
11-
"src/bootstrap/Cargo.toml"
12-
"src/tools/rust-analyzer/Cargo.toml"
1311
"compiler/rustc_codegen_cranelift/Cargo.toml"
14-
"compiler/rustc_codegen_gcc/Cargo.toml"]
12+
"compiler/rustc_codegen_gcc/Cargo.toml"
13+
"library/Cargo.toml"
14+
"src/bootstrap/Cargo.toml"
15+
"src/tools/rust-analyzer/Cargo.toml"]
1516
:rustfmt ( :overrideCommand ["build/host/rustfmt/bin/rustfmt"
1617
"--edition=2021"])
1718
:procMacro ( :server "build/host/stage0/libexec/rust-analyzer-proc-macro-srv"

src/etc/rust_analyzer_settings.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
],
1010
"rust-analyzer.linkedProjects": [
1111
"Cargo.toml",
12+
"compiler/rustc_codegen_cranelift/Cargo.toml",
13+
"compiler/rustc_codegen_gcc/Cargo.toml",
1214
"library/Cargo.toml",
1315
"src/bootstrap/Cargo.toml",
14-
"src/tools/rust-analyzer/Cargo.toml",
15-
"compiler/rustc_codegen_cranelift/Cargo.toml",
16-
"compiler/rustc_codegen_gcc/Cargo.toml"
16+
"src/tools/rust-analyzer/Cargo.toml"
1717
],
1818
"rust-analyzer.rustfmt.overrideCommand": [
1919
"${workspaceFolder}/build/host/rustfmt/bin/rustfmt",
@@ -36,5 +36,10 @@
3636
},
3737
"rust-analyzer.server.extraEnv": {
3838
"RUSTUP_TOOLCHAIN": "nightly"
39+
},
40+
"files.associations": {
41+
"*.fixed": "rust",
42+
"*.pp": "rust",
43+
"*.mir": "rust"
3944
}
4045
}

src/etc/rust_analyzer_zed.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
},
2222
"linkedProjects": [
2323
"Cargo.toml",
24+
"compiler/rustc_codegen_cranelift/Cargo.toml",
25+
"compiler/rustc_codegen_gcc/Cargo.toml",
2426
"library/Cargo.toml",
2527
"src/bootstrap/Cargo.toml",
26-
"src/tools/rust-analyzer/Cargo.toml",
27-
"compiler/rustc_codegen_cranelift/Cargo.toml",
28-
"compiler/rustc_codegen_gcc/Cargo.toml"
28+
"src/tools/rust-analyzer/Cargo.toml"
2929
],
3030
"procMacro": {
31-
"enable": true,
32-
"server": "${workspaceFolder}/build/host/stage0/libexec/rust-analyzer-proc-macro-srv"
31+
"enable": true,
32+
"server": "${workspaceFolder}/build/host/stage0/libexec/rust-analyzer-proc-macro-srv"
3333
},
3434
"rustc": {
3535
"source": "./Cargo.toml"
@@ -47,5 +47,8 @@
4747
}
4848
}
4949
}
50+
},
51+
"file_types": {
52+
"Rust": ["fixed", "pp", "mir"]
5053
}
5154
}

0 commit comments

Comments
 (0)