diff options
| author | Chai T. Rex <ChaiTRex@users.noreply.github.com> | 2025-02-15 16:28:39 -0500 |
|---|---|---|
| committer | Chai T. Rex <ChaiTRex@users.noreply.github.com> | 2025-02-15 17:30:20 -0500 |
| commit | d9f125dcf20f11acea3a7c29c6a3f513350ed964 (patch) | |
| tree | 78a350404905bd45059c4df328c3e656d1c96746 | |
| parent | 18d7ffa8fc82cd85382339a72b8acaa92c7a25b0 (diff) | |
| download | rust-d9f125dcf20f11acea3a7c29c6a3f513350ed964.tar.gz rust-d9f125dcf20f11acea3a7c29c6a3f513350ed964.zip | |
Add support for the Zed IDE to `./x setup`
| -rw-r--r-- | src/bootstrap/src/core/build_steps/setup.rs | 10 | ||||
| -rw-r--r-- | src/etc/rust_analyzer_zed.json | 52 |
2 files changed, 61 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs index a732008afde..523f688bd91 100644 --- a/src/bootstrap/src/core/build_steps/setup.rs +++ b/src/bootstrap/src/core/build_steps/setup.rs @@ -527,6 +527,7 @@ enum EditorKind { Helix, Vim, VsCode, + Zed, } impl EditorKind { @@ -536,6 +537,7 @@ impl EditorKind { 2. Helix 3. Vim 4. VS Code +5. Zed Select which editor you would like to set up [default: None]: "; @@ -552,6 +554,7 @@ Select which editor you would like to set up [default: None]: "; "2" | "helix" => return Ok(Some(EditorKind::Helix)), "3" | "vim" => return Ok(Some(EditorKind::Vim)), "4" | "vscode" => return Ok(Some(EditorKind::VsCode)), + "5" | "zed" => return Ok(Some(EditorKind::Zed)), "" | "none" => return Ok(None), _ => { eprintln!("ERROR: unrecognized option '{}'", input.trim()); @@ -587,6 +590,9 @@ Select which editor you would like to set up [default: None]: "; "4eecb58a2168b252077369da446c30ed0e658301efe69691979d1ef0443928f4", "c394386e6133bbf29ffd32c8af0bb3d4aac354cba9ee051f29612aa9350f8f8d", ], + EditorKind::Zed => { + &["bbce727c269d1bd0c98afef4d612eb4ce27aea3c3a8968c5f10b31affbc40b6c"] + } } } @@ -599,7 +605,7 @@ Select which editor you would like to set up [default: None]: "; EditorKind::Emacs => ".dir-locals.el", EditorKind::Helix => "languages.toml", EditorKind::Vim => "coc-settings.json", - EditorKind::VsCode => "settings.json", + EditorKind::VsCode | EditorKind::Zed => "settings.json", }) } @@ -609,6 +615,7 @@ Select which editor you would like to set up [default: None]: "; EditorKind::Helix => PathBuf::from(".helix"), EditorKind::Vim => PathBuf::from(".vim"), EditorKind::VsCode => PathBuf::from(".vscode"), + EditorKind::Zed => PathBuf::from(".zed"), } } @@ -619,6 +626,7 @@ Select which editor you would like to set up [default: None]: "; EditorKind::Vim | EditorKind::VsCode => { include_str!("../../../../etc/rust_analyzer_settings.json") } + EditorKind::Zed => include_str!("../../../../etc/rust_analyzer_zed.json"), } } diff --git a/src/etc/rust_analyzer_zed.json b/src/etc/rust_analyzer_zed.json new file mode 100644 index 00000000000..469ea050621 --- /dev/null +++ b/src/etc/rust_analyzer_zed.json @@ -0,0 +1,52 @@ +{ + "lsp": { + "rust-analyzer": { + "initialization_options": { + "cargo": { + "buildScripts": { + "enable": true, + "invocationLocation": "root", + "invocationStrategy": "once", + "overrideCommand": ["python3", "x.py", "check", "--json-output"] + }, + "extraEnv": { + "RUSTC_BOOTSTRAP": "1" + }, + "sysrootSrc": "./library" + }, + "check": { + "invocationLocation": "root", + "invocationStrategy": "once", + "overrideCommand": ["python3", "x.py", "check", "--json-output"] + }, + "linkedProjects": [ + "Cargo.toml", + "library/Cargo.toml", + "src/tools/x/Cargo.toml", + "src/bootstrap/Cargo.toml", + "src/tools/rust-analyzer/Cargo.toml", + "compiler/rustc_codegen_cranelift/Cargo.toml", + "compiler/rustc_codegen_gcc/Cargo.toml" + ], + "procMacro": { + "enable": true, + "server": "${workspaceFolder}/build/host/stage0/libexec/rust-analyzer-proc-macro-srv" + }, + "rustc": { + "source": "./Cargo.toml" + }, + "rustfmt": { + "overrideCommand": [ + "${workspaceFolder}/build/host/rustfmt/bin/rustfmt", + "--edition=2021" + ] + }, + "server": { + "extraEnv": { + "RUSTUP_TOOLCHAIN": "nightly" + } + } + } + } + } +} |
