Skip to content

Commit 8cc9a49

Browse files
committed
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.
1 parent 2da29db commit 8cc9a49

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

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)