LoginSignup
7
2

【VSCode】拡張機能「rust-analyzer」のフォーマッタを設定する

Last updated at Posted at 2022-04-09

VSCodeの拡張機能「rust-analyzer」を使用し、フォーマッタを有効にする設定についてメモしておきます。
※ 2022/6/19 更新

設定内容

setting.jsonなどに下記を追加します。
下記は旧設定です。(設定してもWarningになるかと思います。)

setting.json
{
    "[rust]": {
            "editor.defaultFormatter": "matklad.rust-analyzer"
    }
}

現在はrust-analyzerのパブリッシャーがrust-langになった?ため、下記を追加します。

setting.json
{
    "[rust]": {
            "editor.defaultFormatter": "rust-lang.rust-analyzer"
    }
}

ファイル保存時やペースト時、入力後に自動でフォーマットしてほしい場合は下記を追加します。

setting.json
{
    "editor.formatOnSave": true,
    "editor.formatOnPaste": true,
    "editor.formatOnType": true
}
7
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
2