From 235d57c053ee0790cf401e4f09c6bdff7000a1cc Mon Sep 17 00:00:00 2001 From: Emily Date: Sat, 9 Nov 2024 02:13:28 +0100 Subject: [PATCH] docs: beginnings of an 'editor setup' section --- .gitignore | 2 ++ docs/contributing.md | 50 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/.gitignore b/.gitignore index 900fc0a2f..903b25691 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ result # Editor specific ignores .idea +.vscode +.zed # Generated by setting `JJ_TRACE` environment variable. jj-trace-*.json diff --git a/docs/contributing.md b/docs/contributing.md index f4a2639b8..b336bdc85 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -216,6 +216,56 @@ to use" instructions](https://github.com/rui314/mold#how-to-use). On recent versions of MacOS, the default linker Rust uses is already multi-threaded. It should use all the CPU cores without any configuration. +### Editor setup + +#### Visual Studio Code + +We recommend at least these settings: + +```js +{ + "files.insertFinalNewline": true, + "files.trimTrailingWhitespace": true, + "[rust]": { + "files.trimTrailingWhitespace": false + } +} +``` + +#### Zed + +```js +// .zed/settings.json +{ + "ensure_final_newline_on_save": true, + "remove_trailing_whitespace_on_save": true, + + "languages": { + // We don't use a formatter for Markdown files, so format_on_save would just + // mess with others' docs + "Markdown": { "format_on_save": "off" } + "Rust": { + "format_on_save": "on", + // Avoid removing trailing spaces within multi-line string literals + "remove_trailing_whitespace_on_save": false + } + }, + + "lsp": { + "rust-analyzer": { + "initialization_options": { + // If you are working on docs and don't need `cargo check`, uncomment + // this option: + // + // "checkOnSave": false, + + // Use nightly `rustfmt`, equivalent to `cargo +nightly fmt` + "rustfmt": { "extraArgs": ["+nightly"] } + } + } + } +} +``` ## Previewing the HTML documentation