summaryrefslogtreecommitdiff
path: root/vscode/settings.json
blob: 87c9cb52a231ea2e0ccd2ac36e66e7de9b7ce51e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
  // Use the rustup/cargo-installed server rather than the one bundled with
  // the extension, so it tracks the toolchain.
  "rust-analyzer.server.path": "~/.cargo/bin/rust-analyzer",
  "rust-analyzer.restartServerOnConfigChange": true,
  "rust-analyzer.showSyntaxTree": true,
  "rust-analyzer.statusBar.showStatusBar": {
    "documentSelector": [
      { "language": "rust" },
      { "pattern": "**/Cargo.toml" },
      { "pattern": "**/Cargo.lock" },
      { "scheme": "output", "pattern": "extension-output-rust-lang.rust-analyzer*" }
    ]
  },

  // Run clippy instead of plain cargo check on save, so clippy lints appear
  // as editor diagnostics with quick fixes instead of only on the CLI.
  "rust-analyzer.check.command": "clippy",

  "[rust]": {
    // Indentation: spaces, 4 wide — rustfmt's defaults (hard_tabs = false,
    // tab_spaces = 4), so what you type matches what format-on-save produces.
    //
    // These are stated explicitly rather than left to VS Code's defaults because
    // detectIndentation is on by default and guesses from the file's existing
    // content when it opens, which would override insertSpaces and tabSize.
    "editor.detectIndentation": false,
    "editor.insertSpaces": true,
    "editor.tabSize": 4,

    // Formatting is rustfmt via rust-analyzer; honors rustfmt.toml if present.
    "editor.defaultFormatter": "rust-lang.rust-analyzer",
    "editor.formatOnSave": true,

    // Applies rust-analyzer's own diagnostic fixes. Fixes originating from
    // cargo check/clippy arrive via flycheck and are NOT covered here - those
    // still need `cargo fix` / `cargo clippy --fix`.
    "editor.codeActionsOnSave": {
      "source.fixAll.rust-analyzer": "explicit"
    }
  }
}