← LOG/TECHNOLOGY/ENTRY N° 149

inlay hints for Rust development with Visual Studio Code

Visual studio code guidelines to turn OFF/ON inlay hints for Rust language. Some people prefer inlay hints while others find it confusing when not accustomed. This article shows you settings that can be configured in Visual Studio code for inlay...

FILED
READ
1 MIN
CATEGORY
TECHNOLOGY

Open Settings.json and enter the following.

I am using Darcula theme so I am wrapping colorCustomizations inside that key.

  • You can remove that key if you want color customizations to be applied across all themes.
  • Change color for typeForeground and typeBackground to your likings
  • Uncomment line which has offUnlessPressed to toggle inlayHints upon keypress CTRL + alt
    "workbench.colorCustomizations": {
      [Darcula]: {
          "editorInlayHint.typeForeground": "#525252",
          "editorInlayHint.typeBackground": "#2D2D2D"
        },
      }

    "[rust]": {
        "editor.defaultFormatter": "rust-lang.rust-analyzer"
        // "editor.inlayHints.enabled": "offUnlessPressed"
    },
    "rust-analyzer.inlayHints.bindingModeHints.enable": false,
    "rust-analyzer.inlayHints.closureReturnTypeHints.enable": "never",
    "rust-analyzer.inlayHints.typeHints.enable": false,
    "rust-analyzer.inlayHints.parameterHints.enable": false,

This is how it looks after inlay hints setting change.

Vscode settings for inlay hints

visit https://github.com/rust-lang/rust-analyzer/issues/4334 for issue discussions.

■ END OF ENTRY 149