Reference Documentation for Rust Analyzer Options

2024-03-04

Rust Analyzer Options

TOC

rust-analyzer

rust-analyzer

rust-analyzer.cargoRunner

type: ['null', 'string']
Custom cargo runner extension ID.

rust-analyzer.runnables.extraEnv

anyOf:

{'type': 'null'}
{'type': 'array', 'items': {'type': 'object', 'properties': {'platform': {'type': ['null', 'string', 'array'], 'default': None, 'markdownDescription': 'Platform(s) filter like "win32" or ["linux", "win32"]. See [process.platform](https://nodejs.org/api/process.html#processplatform) values.'}, 'mask': {'type': 'string', 'description': 'Runnable name mask'}, 'env': {'type': 'object', 'description': 'Variables in form of { "key": "value"}'}}}}
{'type': 'object', 'description': 'Variables in form of { "key": "value"}'}

Environment variables passed to the runnable launched using Test or Debug lens or rust-analyzer.run command.

rust-analyzer.runnables.problemMatcher

type: array
default: ['$rustc']
Problem matchers to use for rust-analyzer.run command, eg ["$rustc", "$rust-panic"].

key value
items {‘type’: ‘string’}

rust-analyzer.statusBar.clickAction

type: string
default: openLogs
Action to run when clicking the extension status bar item.

possible values

value description
stopServer Stop Server
openLogs Open Logs

rust-analyzer.server.path

type: ['null', 'string']
Path to rust-analyzer executable (points to bundled binary by default).

key value
scope machine-overridable

rust-analyzer.server.extraEnv

type: ['null', 'object']
Extra environment variables that will be passed to the rust-analyzer executable. Useful for passing e.g. RA_LOG for debugging.

key value
additionalProperties {‘type’: [‘string’, ‘number’]}

rust-analyzer.trace.server

type: string
default: off
Trace requests to the rust-analyzer (this is usually overly verbose and not recommended for regular users).

possible values

value description
off No traces
messages Error only
verbose Full log
key value
scope window

rust-analyzer.trace.extension

type: boolean
default: False
Enable logging of VS Code extensions itself.

rust-analyzer.debug.engine

type: string
default: auto
Preferred debug engine.

possible values

value description
auto First try to use CodeLLDB, if it’s not installed try to use MS C++ tools.
vadimcn.vscode-lldb Use CodeLLDB
ms-vscode.cpptools Use MS C++ tools

rust-analyzer.debug.sourceFileMap

type: ['object', 'string']
default:

{
  "/rustc/<id>": "${env:USERPROFILE}/.rustup/toolchains/<toolchain-id>/lib/rustlib/src/rust"
}

Optional source file mappings passed to the debug engine.

key value
const auto

rust-analyzer.debug.openDebugPane

type: boolean
default: False
Whether to open up the Debug Panel on debugging start.

rust-analyzer.debug.engineSettings

type: object
default: {}
Optional settings passed to the debug engine. Example: { "lldb": { "terminal":"external"} }

rust-analyzer.restartServerOnConfigChange

type: boolean
default: False
Whether to restart the server automatically when certain settings that require a restart are changed.

rust-analyzer.typing.continueCommentsOnNewline

type: boolean
default: True
Whether to prefix newlines after comments with the corresponding comment prefix.

rust-analyzer.diagnostics.previewRustcOutput

type: boolean
default: False
Whether to show the main part of the rendered rustc output of a diagnostic message.

rust-analyzer.diagnostics.useRustcErrorCode

type: boolean
default: False
Whether to show diagnostics using the original rustc error code. If this is false, all rustc diagnostics will have the code ‘rustc(Click for full compiler diagnostics)’

rust-analyzer.discoverProjectRunner

type: ['null', 'string']
Sets the extension responsible for determining which extension the rust-analyzer extension uses to generate rust-project.json files. This should should only be used if a build system like Buck or Bazel is also in use.

rust-analyzer.showUnlinkedFileNotification

type: boolean
default: True
Whether to show a notification for unlinked files asking the user to add the corresponding Cargo.toml to the linked projects setting.

rust-analyzer.showRequestFailedErrorNotification

type: boolean
default: True
Whether to show error notifications for failing requests.

rust-analyzer.showDependenciesExplorer

type: boolean
default: True
Whether to show the dependencies view.

rust-analyzer.assist.emitMustUse

type: boolean
default: False
Whether to insert #[must_use] when generating as_ methods for enum variants.

rust-analyzer.assist.expressionFillDefault

type: string
default: todo
Placeholder expression to use for missing expressions in assists.

possible values

value description
todo Fill missing expressions with the todo macro
default Fill missing expressions with reasonable defaults, new or default constructors.

rust-analyzer.cachePriming.enable

type: boolean
default: True
Warm up caches on project load.

rust-analyzer.cachePriming.numThreads

type: number
default: 0
minimum: 0
maximum: 255
How many worker threads to handle priming caches. The default 0 means to pick automatically.

rust-analyzer.cargo.autoreload

type: boolean
default: True
Automatically refresh project info via cargo metadata on Cargo.toml or .cargo/config.toml changes.

rust-analyzer.cargo.buildScripts.enable

type: boolean
default: True
Run build scripts (build.rs) for more precise code analysis.

rust-analyzer.cargo.buildScripts.invocationLocation

type: string
default: workspace
Specifies the working directory for running build scripts. - “workspace”: run build scripts for a workspace in the workspace’s root directory. This is incompatible with #rust-analyzer.cargo.buildScripts.invocationStrategy# set to once. - “root”: run build scripts in the project’s root directory. This config only has an effect when #rust-analyzer.cargo.buildScripts.overrideCommand# is set.

possible values

value description
workspace The command will be executed in the corresponding workspace root.
root The command will be executed in the project root.

rust-analyzer.cargo.buildScripts.invocationStrategy

type: string
default: per_workspace
Specifies the invocation strategy to use when running the build scripts command. If per_workspace is set, the command will be executed for each workspace. If once is set, the command will be executed once. This config only has an effect when #rust-analyzer.cargo.buildScripts.overrideCommand# is set.

possible values

value description
per_workspace The command will be executed for each workspace.
once The command will be executed once.

rust-analyzer.cargo.buildScripts.overrideCommand

type: ['null', 'array']
Override the command rust-analyzer uses to run build scripts and build procedural macros. The command is required to output json and should therefore include --message-format=json or a similar option.

If there are multiple linked projects/workspaces, this command is invoked for each of them, with the working directory being the workspace root (i.e., the folder containing the Cargo.toml). This can be overwritten by changing #rust-analyzer.cargo.buildScripts.invocationStrategy# and #rust-analyzer.cargo.buildScripts.invocationLocation#.

By default, a cargo invocation will be constructed for the configured targets and features, with the following base command line:

cargo check --quiet --workspace --message-format=json --all-targets

.

key value
items {‘type’: ‘string’}

rust-analyzer.cargo.buildScripts.rebuildOnSave

type: boolean
default: True
Rerun proc-macros building/build-scripts running when proc-macro or build-script sources change and are saved.

rust-analyzer.cargo.buildScripts.useRustcWrapper

type: boolean
default: True
Use RUSTC_WRAPPER=rust-analyzer when running build scripts to avoid checking unnecessary things.

rust-analyzer.cargo.cfgs

type: object
default: {}
List of cfg options to enable with the given values.

rust-analyzer.cargo.extraArgs

type: array
default: []
Extra arguments that are passed to every cargo invocation.

key value
items {‘type’: ‘string’}

rust-analyzer.cargo.extraEnv

type: object
default: {}
Extra environment variables that will be set when running cargo, rustc or other commands within the workspace. Useful for setting RUSTFLAGS.

rust-analyzer.cargo.features

default: []
anyOf:

{'type': 'string', 'enum': ['all'], 'enumDescriptions': ['Pass `--all-features` to cargo']}
{'type': 'array', 'items': {'type': 'string'}}

List of features to activate.

Set this to "all" to pass --all-features to cargo.

rust-analyzer.cargo.noDefaultFeatures

type: boolean
default: False
Whether to pass --no-default-features to cargo.

rust-analyzer.cargo.sysroot

type: ['null', 'string']
default: discover
Relative path to the sysroot, or “discover” to try to automatically find it via “rustc –print sysroot”.

Unsetting this disables sysroot loading.

This option does not take effect until rust-analyzer is restarted.

rust-analyzer.cargo.sysrootQueryMetadata

type: boolean
default: False
Whether to run cargo metadata on the sysroot library allowing rust-analyzer to analyze third-party dependencies of the standard libraries.

This will cause cargo to create a lockfile in your sysroot directory. rust-analyzer will attempt to clean up afterwards, but nevertheless requires the location to be writable to.

rust-analyzer.cargo.sysrootSrc

type: ['null', 'string']
Relative path to the sysroot library sources. If left unset, this will default to {cargo.sysroot}/lib/rustlib/src/rust/library.

This option does not take effect until rust-analyzer is restarted.

rust-analyzer.cargo.target

type: ['null', 'string']
Compilation target override (target triple).

rust-analyzer.cargo.targetDir

anyOf:

{'type': 'null'}
{'type': 'boolean'}
{'type': 'string'}

Optional path to a rust-analyzer specific target directory. This prevents rust-analyzer’s cargo check and initial build-script and proc-macro building from locking the Cargo.lock at the expense of duplicating build artifacts.

Set to true to use a subdirectory of the existing target directory or set to a path relative to the workspace to use that path.

rust-analyzer.cargo.unsetTest

type: array
default: ['core']
Unsets the implicit #[cfg(test)] for the specified crates.

key value
items {‘type’: ‘string’}

rust-analyzer.checkOnSave

type: boolean
default: True
Run the check command for diagnostics on save.

rust-analyzer.check.allTargets

type: boolean
default: True
Check all targets and tests (--all-targets).

rust-analyzer.check.command

type: string
default: check
Cargo command to use for cargo check.

rust-analyzer.check.extraArgs

type: array
default: []
Extra arguments for cargo check.

key value
items {‘type’: ‘string’}

rust-analyzer.check.extraEnv

type: object
default: {}
Extra environment variables that will be set when running cargo check. Extends #rust-analyzer.cargo.extraEnv#.

rust-analyzer.check.features

anyOf:

{'type': 'string', 'enum': ['all'], 'enumDescriptions': ['Pass `--all-features` to cargo']}
{'type': 'array', 'items': {'type': 'string'}}
{'type': 'null'}

List of features to activate. Defaults to #rust-analyzer.cargo.features#.

Set to "all" to pass --all-features to Cargo.

rust-analyzer.check.ignore

type: array
default: []
List of cargo check (or other command specified in check.command) diagnostics to ignore.

For example for cargo check: dead_code, unused_imports, unused_variables,…

key value
items {‘type’: ‘string’}
uniqueItems True

rust-analyzer.check.invocationLocation

type: string
default: workspace
Specifies the working directory for running checks. - “workspace”: run checks for workspaces in the corresponding workspaces’ root directories. This falls back to “root” if #rust-analyzer.check.invocationStrategy# is set to once. - “root”: run checks in the project’s root directory. This config only has an effect when #rust-analyzer.check.overrideCommand# is set.

possible values

value description
workspace The command will be executed in the corresponding workspace root.
root The command will be executed in the project root.

rust-analyzer.check.invocationStrategy

type: string
default: per_workspace
Specifies the invocation strategy to use when running the check command. If per_workspace is set, the command will be executed for each workspace. If once is set, the command will be executed once. This config only has an effect when #rust-analyzer.check.overrideCommand# is set.

possible values

value description
per_workspace The command will be executed for each workspace.
once The command will be executed once.

rust-analyzer.check.noDefaultFeatures

type: ['null', 'boolean']
Whether to pass --no-default-features to Cargo. Defaults to #rust-analyzer.cargo.noDefaultFeatures#.

rust-analyzer.check.overrideCommand

type: ['null', 'array']
Override the command rust-analyzer uses instead of cargo check for diagnostics on save. The command is required to output json and should therefore include --message-format=json or a similar option (if your client supports the colorDiagnosticOutput experimental capability, you can use --message-format=json-diagnostic-rendered-ansi).

If you’re changing this because you’re using some tool wrapping Cargo, you might also want to change #rust-analyzer.cargo.buildScripts.overrideCommand#.

If there are multiple linked projects/workspaces, this command is invoked for each of them, with the working directory being the workspace root (i.e., the folder containing the Cargo.toml). This can be overwritten by changing #rust-analyzer.check.invocationStrategy# and #rust-analyzer.check.invocationLocation#.

If $saved_file is part of the command, rust-analyzer will pass the absolute path of the saved file to the provided command. This is intended to be used with non-Cargo build systems. Note that $saved_file is experimental and may be removed in the futureg.

An example command would be:

cargo check --workspace --message-format=json --all-targets

.

key value
items {‘type’: ‘string’}

rust-analyzer.check.targets

anyOf:

{'type': 'null'}
{'type': 'string'}
{'type': 'array', 'items': {'type': 'string'}}

Check for specific targets. Defaults to #rust-analyzer.cargo.target# if empty.

Can be a single target, e.g. "x86_64-unknown-linux-gnu" or a list of targets, e.g. ["aarch64-apple-darwin", "x86_64-apple-darwin"].

Aliased as "checkOnSave.targets".

rust-analyzer.check.workspace

type: boolean
default: True
Whether --workspace should be passed to cargo check. If false, -p <package> will be passed instead.

rust-analyzer.completion.autoimport.enable

type: boolean
default: True
Toggles the additional completions that automatically add imports when completed. Note that your client must specify the additionalTextEdits LSP client capability to truly have this feature enabled.

rust-analyzer.completion.autoself.enable

type: boolean
default: True
Toggles the additional completions that automatically show method calls and field accesses with self prefixed to them when inside a method.

rust-analyzer.completion.callable.snippets

type: string
default: fill_arguments
Whether to add parenthesis and argument snippets when completing function.

possible values

value description
fill_arguments Add call parentheses and pre-fill arguments.
add_parentheses Add call parentheses.
none Do no snippet completions for callables.

rust-analyzer.completion.fullFunctionSignatures.enable

type: boolean
default: False
Whether to show full function/method signatures in completion docs.

rust-analyzer.completion.limit

type: ['null', 'integer']
minimum: 0
Maximum number of completions to return. If None, the limit is infinite.

rust-analyzer.completion.postfix.enable

type: boolean
default: True
Whether to show postfix snippets like dbg, if, not, etc.

rust-analyzer.completion.privateEditable.enable

type: boolean
default: False
Enables completions of private items and fields that are defined in the current workspace even if they are not visible at the current position.

rust-analyzer.completion.snippets.custom

type: object
default:

{
  "Arc::new": {
    "postfix": "arc",
    "body": "Arc::new(${receiver})",
    "requires": "std::sync::Arc",
    "description": "Put the expression into an `Arc`",
    "scope": "expr"
  },
  "Rc::new": {
    "postfix": "rc",
    "body": "Rc::new(${receiver})",
    "requires": "std::rc::Rc",
    "description": "Put the expression into an `Rc`",
    "scope": "expr"
  },
  "Box::pin": {
    "postfix": "pinbox",
    "body": "Box::pin(${receiver})",
    "requires": "std::boxed::Box",
    "description": "Put the expression into a pinned `Box`",
    "scope": "expr"
  },
  "Ok": {
    "postfix": "ok",
    "body": "Ok(${receiver})",
    "description": "Wrap the expression in a `Result::Ok`",
    "scope": "expr"
  },
  "Err": {
    "postfix": "err",
    "body": "Err(${receiver})",
    "description": "Wrap the expression in a `Result::Err`",
    "scope": "expr"
  },
  "Some": {
    "postfix": "some",
    "body": "Some(${receiver})",
    "description": "Wrap the expression in an `Option::Some`",
    "scope": "expr"
  }
}

Custom completion snippets.

rust-analyzer.completion.termSearch.enable

type: boolean
default: False
Whether to enable term search based snippets like Some(foo.bar().baz()).

rust-analyzer.diagnostics.disabled

type: array
default: []
List of rust-analyzer diagnostics to disable.

key value
items {‘type’: ‘string’}
uniqueItems True

rust-analyzer.diagnostics.enable

type: boolean
default: True
Whether to show native rust-analyzer diagnostics.

rust-analyzer.diagnostics.experimental.enable

type: boolean
default: False
Whether to show experimental rust-analyzer diagnostics that might have more false positives than usual.

rust-analyzer.diagnostics.remapPrefix

type: object
default: {}
Map of prefixes to be substituted when parsing diagnostic file paths. This should be the reverse mapping of what is passed to rustc as --remap-path-prefix.

rust-analyzer.diagnostics.warningsAsHint

type: array
default: []
List of warnings that should be displayed with hint severity.

The warnings will be indicated by faded text or three dots in code and will not show up in the Problems Panel.

key value
items {‘type’: ‘string’}

rust-analyzer.diagnostics.warningsAsInfo

type: array
default: []
List of warnings that should be displayed with info severity.

The warnings will be indicated by a blue squiggly underline in code and a blue icon in the Problems Panel.

key value
items {‘type’: ‘string’}

rust-analyzer.files.excludeDirs

type: array
default: []
These directories will be ignored by rust-analyzer. They are relative to the workspace root, and globs are not supported. You may also need to add the folders to Code’s files.watcherExclude.

key value
items {‘type’: ‘string’}

rust-analyzer.files.watcher

type: string
default: client
Controls file watching implementation.

possible values

value description
client Use the client (editor) to watch files for changes
server Use server-side file watching

rust-analyzer.highlightRelated.breakPoints.enable

type: boolean
default: True
Enables highlighting of related references while the cursor is on break, loop, while, or for keywords.

rust-analyzer.highlightRelated.closureCaptures.enable

type: boolean
default: True
Enables highlighting of all captures of a closure while the cursor is on the | or move keyword of a closure.

rust-analyzer.highlightRelated.exitPoints.enable

type: boolean
default: True
Enables highlighting of all exit points while the cursor is on any return, ?, fn, or return type arrow (->).

rust-analyzer.highlightRelated.references.enable

type: boolean
default: True
Enables highlighting of related references while the cursor is on any identifier.

rust-analyzer.highlightRelated.yieldPoints.enable

type: boolean
default: True
Enables highlighting of all break points for a loop or block context while the cursor is on any async or await keywords.

rust-analyzer.hover.actions.debug.enable

type: boolean
default: True
Whether to show Debug action. Only applies when #rust-analyzer.hover.actions.enable# is set.

rust-analyzer.hover.actions.enable

type: boolean
default: True
Whether to show HoverActions in Rust files.

rust-analyzer.hover.actions.gotoTypeDef.enable

type: boolean
default: True
Whether to show Go to Type Definition action. Only applies when #rust-analyzer.hover.actions.enable# is set.

rust-analyzer.hover.actions.implementations.enable

type: boolean
default: True
Whether to show Implementations action. Only applies when #rust-analyzer.hover.actions.enable# is set.

rust-analyzer.hover.actions.references.enable

type: boolean
default: False
Whether to show References action. Only applies when #rust-analyzer.hover.actions.enable# is set.

rust-analyzer.hover.actions.run.enable

type: boolean
default: True
Whether to show Run action. Only applies when #rust-analyzer.hover.actions.enable# is set.

rust-analyzer.hover.documentation.enable

type: boolean
default: True
Whether to show documentation on hover.

rust-analyzer.hover.documentation.keywords.enable

type: boolean
default: True
Whether to show keyword hover popups. Only applies when #rust-analyzer.hover.documentation.enable# is set.

type: boolean
default: True
Use markdown syntax for links on hover.

rust-analyzer.hover.memoryLayout.alignment

default: hexadecimal
anyOf:

{'type': 'null'}
{'type': 'string', 'enum': ['both', 'decimal', 'hexadecimal'], 'enumDescriptions': ['Render as 12 (0xC)', 'Render as 12', 'Render as 0xC']}

How to render the align information in a memory layout hover.

rust-analyzer.hover.memoryLayout.enable

type: boolean
default: True
Whether to show memory layout data on hover.

rust-analyzer.hover.memoryLayout.niches

type: ['null', 'boolean']
default: False
How to render the niche information in a memory layout hover.

rust-analyzer.hover.memoryLayout.offset

default: hexadecimal
anyOf:

{'type': 'null'}
{'type': 'string', 'enum': ['both', 'decimal', 'hexadecimal'], 'enumDescriptions': ['Render as 12 (0xC)', 'Render as 12', 'Render as 0xC']}

How to render the offset information in a memory layout hover.

rust-analyzer.hover.memoryLayout.size

default: both
anyOf:

{'type': 'null'}
{'type': 'string', 'enum': ['both', 'decimal', 'hexadecimal'], 'enumDescriptions': ['Render as 12 (0xC)', 'Render as 12', 'Render as 0xC']}

How to render the size information in a memory layout hover.

rust-analyzer.imports.granularity.enforce

type: boolean
default: False
Whether to enforce the import granularity setting for all files. If set to false rust-analyzer will try to keep import styles consistent per file.

rust-analyzer.imports.granularity.group

type: string
default: crate
How imports should be grouped into use statements.

possible values

value description
preserve Do not change the granularity of any imports and preserve the original structure written by the developer.
crate Merge imports from the same crate into a single use statement. Conversely, imports from different crates are split into separate statements.
module Merge imports from the same module into a single use statement. Conversely, imports from different modules are split into separate statements.
item Flatten imports so that each has its own use statement.
one Merge all imports into a single use statement as long as they have the same visibility and attributes.

rust-analyzer.imports.group.enable

type: boolean
default: True
Group inserted imports by the following order. Groups are separated by newlines.

rust-analyzer.imports.merge.glob

type: boolean
default: True
Whether to allow import insertion to merge new imports into single path glob imports like use std::fmt::*;.

rust-analyzer.imports.preferNoStd

type: boolean
default: False
Prefer to unconditionally use imports of the core and alloc crate, over the std crate.

rust-analyzer.imports.preferPrelude

type: boolean
default: False
Whether to prefer import paths containing a prelude module.

rust-analyzer.imports.prefix

type: string
default: plain
The path structure for newly inserted paths to use.

possible values

value description
plain Insert import paths relative to the current module, using up to one super prefix if the parent module contains the requested item.
self Insert import paths relative to the current module, using up to one super prefix if the parent module contains the requested item. Prefixes self in front of the path if it starts with a module.
crate Force import paths to be absolute by always starting them with crate or the extern crate name they come from.

rust-analyzer.inlayHints.bindingModeHints.enable

type: boolean
default: False
Whether to show inlay type hints for binding modes.

rust-analyzer.inlayHints.chainingHints.enable

type: boolean
default: True
Whether to show inlay type hints for method chains.

rust-analyzer.inlayHints.closingBraceHints.enable

type: boolean
default: True
Whether to show inlay hints after a closing } to indicate what item it belongs to.

rust-analyzer.inlayHints.closingBraceHints.minLines

type: integer
default: 25
minimum: 0
Minimum number of lines required before the } until the hint is shown (set to 0 or 1 to always show them).

rust-analyzer.inlayHints.closureCaptureHints.enable

type: boolean
default: False
Whether to show inlay hints for closure captures.

rust-analyzer.inlayHints.closureReturnTypeHints.enable

type: string
default: never
Whether to show inlay type hints for return types of closures.

possible values

value description
always Always show type hints for return types of closures.
never Never show type hints for return types of closures.
with_block Only show type hints for return types of closures with blocks.

rust-analyzer.inlayHints.closureStyle

type: string
default: impl_fn
Closure notation in type and chaining inlay hints.

possible values

value description
impl_fn impl_fn: impl FnMut(i32, u64) -> i8
rust_analyzer rust_analyzer: |i32, u64| -> i8
with_id with_id: {closure#14352}, where that id is the unique number of the closure in r-a internals
hide hide: Shows ... for every closure type

rust-analyzer.inlayHints.discriminantHints.enable

type: string
default: never
Whether to show enum variant discriminant hints.

possible values

value description
always Always show all discriminant hints.
never Never show discriminant hints.
fieldless Only show discriminant hints on fieldless enum variants.

rust-analyzer.inlayHints.expressionAdjustmentHints.enable

type: string
default: never
Whether to show inlay hints for type adjustments.

possible values

value description
always Always show all adjustment hints.
never Never show adjustment hints.
reborrow Only show auto borrow and dereference adjustment hints.

rust-analyzer.inlayHints.expressionAdjustmentHints.hideOutsideUnsafe

type: boolean
default: False
Whether to hide inlay hints for type adjustments outside of unsafe blocks.

rust-analyzer.inlayHints.expressionAdjustmentHints.mode

type: string
default: prefix
Whether to show inlay hints as postfix ops (.* instead of *, etc).

possible values

value description
prefix Always show adjustment hints as prefix (*expr).
postfix Always show adjustment hints as postfix (expr.*).
prefer_prefix Show prefix or postfix depending on which uses less parenthesis, preferring prefix.
prefer_postfix Show prefix or postfix depending on which uses less parenthesis, preferring postfix.

rust-analyzer.inlayHints.implicitDrops.enable

type: boolean
default: False
Whether to show implicit drop hints.

rust-analyzer.inlayHints.lifetimeElisionHints.enable

type: string
default: never
Whether to show inlay type hints for elided lifetimes in function signatures.

possible values

value description
always Always show lifetime elision hints.
never Never show lifetime elision hints.
skip_trivial Only show lifetime elision hints if a return type is involved.

rust-analyzer.inlayHints.lifetimeElisionHints.useParameterNames

type: boolean
default: False
Whether to prefer using parameter names as the name for elided lifetime hints if possible.

rust-analyzer.inlayHints.maxLength

type: ['null', 'integer']
default: 25
minimum: 0
Maximum length for inlay hints. Set to null to have an unlimited length.

rust-analyzer.inlayHints.parameterHints.enable

type: boolean
default: True
Whether to show function parameter name inlay hints at the call site.

rust-analyzer.inlayHints.rangeExclusiveHints.enable

type: boolean
default: False
Whether to show exclusive range inlay hints.

rust-analyzer.inlayHints.reborrowHints.enable

type: string
default: never
Whether to show inlay hints for compiler inserted reborrows. This setting is deprecated in favor of #rust-analyzer.inlayHints.expressionAdjustmentHints.enable#.

possible values

value description
always Always show reborrow hints.
never Never show reborrow hints.
mutable Only show mutable reborrow hints.

rust-analyzer.inlayHints.renderColons

type: boolean
default: True
Whether to render leading colons for type hints, and trailing colons for parameter hints.

rust-analyzer.inlayHints.typeHints.enable

type: boolean
default: True
Whether to show inlay type hints for variables.

rust-analyzer.inlayHints.typeHints.hideClosureInitialization

type: boolean
default: False
Whether to hide inlay type hints for let statements that initialize to a closure. Only applies to closures with blocks, same as #rust-analyzer.inlayHints.closureReturnTypeHints.enable#.

rust-analyzer.inlayHints.typeHints.hideNamedConstructor

type: boolean
default: False
Whether to hide inlay type hints for constructors.

rust-analyzer.interpret.tests

type: boolean
default: False
Enables the experimental support for interpreting tests.

rust-analyzer.joinLines.joinAssignments

type: boolean
default: True
Join lines merges consecutive declaration and initialization of an assignment.

rust-analyzer.joinLines.joinElseIf

type: boolean
default: True
Join lines inserts else between consecutive ifs.

rust-analyzer.joinLines.removeTrailingComma

type: boolean
default: True
Join lines removes trailing commas.

rust-analyzer.joinLines.unwrapTrivialBlock

type: boolean
default: True
Join lines unwraps trivial blocks.

rust-analyzer.lens.debug.enable

type: boolean
default: True
Whether to show Debug lens. Only applies when #rust-analyzer.lens.enable# is set.

rust-analyzer.lens.enable

type: boolean
default: True
Whether to show CodeLens in Rust files.

rust-analyzer.lens.forceCustomCommands

type: boolean
default: True
Internal config: use custom client-side commands even when the client doesn’t set the corresponding capability.

rust-analyzer.lens.implementations.enable

type: boolean
default: True
Whether to show Implementations lens. Only applies when #rust-analyzer.lens.enable# is set.

rust-analyzer.lens.location

type: string
default: above_name
Where to render annotations.

possible values

value description
above_name Render annotations above the name of the item.
above_whole_item Render annotations above the whole item, including documentation comments and attributes.

rust-analyzer.lens.references.adt.enable

type: boolean
default: False
Whether to show References lens for Struct, Enum, and Union. Only applies when #rust-analyzer.lens.enable# is set.

rust-analyzer.lens.references.enumVariant.enable

type: boolean
default: False
Whether to show References lens for Enum Variants. Only applies when #rust-analyzer.lens.enable# is set.

rust-analyzer.lens.references.method.enable

type: boolean
default: False
Whether to show Method References lens. Only applies when #rust-analyzer.lens.enable# is set.

rust-analyzer.lens.references.trait.enable

type: boolean
default: False
Whether to show References lens for Trait. Only applies when #rust-analyzer.lens.enable# is set.

rust-analyzer.lens.run.enable

type: boolean
default: True
Whether to show Run lens. Only applies when #rust-analyzer.lens.enable# is set.

rust-analyzer.linkedProjects

type: array
default: []
Disable project auto-discovery in favor of explicitly specified set of projects.

Elements must be paths pointing to Cargo.toml, rust-project.json, or JSON objects in rust-project.json format.

key value
items {‘type’: [‘string’, ‘object’]}

rust-analyzer.lru.capacity

type: ['null', 'integer']
minimum: 0
Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.

rust-analyzer.lru.query.capacities

type: object
default: {}
Sets the LRU capacity of the specified queries.

rust-analyzer.notifications.cargoTomlNotFound

type: boolean
default: True
Whether to show can't find Cargo.toml error message.

rust-analyzer.notifications.unindexedProject

type: boolean
default: False
Whether to send an UnindexedProject notification to the client.

rust-analyzer.numThreads

type: ['null', 'integer']
minimum: 0
How many worker threads in the main loop. The default null means to pick automatically.

rust-analyzer.procMacro.attributes.enable

type: boolean
default: True
Expand attribute macros. Requires #rust-analyzer.procMacro.enable# to be set.

rust-analyzer.procMacro.enable

type: boolean
default: True
Enable support for procedural macros, implies #rust-analyzer.cargo.buildScripts.enable#.

rust-analyzer.procMacro.ignored

type: object
default: {}
These proc-macros will be ignored when trying to expand them.

This config takes a map of crate names with the exported proc-macro names to ignore as values.

rust-analyzer.procMacro.server

type: ['null', 'string']
Internal config, path to proc-macro server executable.

rust-analyzer.references.excludeImports

type: boolean
default: False
Exclude imports from find-all-references.

rust-analyzer.references.excludeTests

type: boolean
default: False
Exclude tests from find-all-references.

rust-analyzer.runnables.command

type: ['null', 'string']
Command to be executed instead of ‘cargo’ for runnables.

rust-analyzer.runnables.extraArgs

type: array
default: []
Additional arguments to be passed to cargo for runnables such as tests or binaries. For example, it may be --release.

key value
items {‘type’: ‘string’}

rust-analyzer.rustc.source

type: ['null', 'string']
Path to the Cargo.toml of the rust compiler workspace, for usage in rustc_private projects, or “discover” to try to automatically find it if the rustc-dev component is installed.

Any project which uses rust-analyzer with the rustcPrivate crates must set [package.metadata.rust-analyzer] rustc_private=true to use it.

This option does not take effect until rust-analyzer is restarted.

rust-analyzer.rustfmt.extraArgs

type: array
default: []
Additional arguments to rustfmt.

key value
items {‘type’: ‘string’}

rust-analyzer.rustfmt.overrideCommand

type: ['null', 'array']
Advanced option, fully override the command rust-analyzer uses for formatting. This should be the equivalent of rustfmt here, and not that of cargo fmt. The file contents will be passed on the standard input and the formatted result will be read from the standard output.

key value
items {‘type’: ‘string’}

rust-analyzer.rustfmt.rangeFormatting.enable

type: boolean
default: False
Enables the use of rustfmt’s unstable range formatting command for the textDocument/rangeFormatting request. The rustfmt option is unstable and only available on a nightly build.

rust-analyzer.semanticHighlighting.doc.comment.inject.enable

type: boolean
default: True
Inject additional highlighting into doc comments.

When enabled, rust-analyzer will highlight rust source in doc comments as well as intra doc links.

rust-analyzer.semanticHighlighting.nonStandardTokens

type: boolean
default: True
Whether the server is allowed to emit non-standard tokens and modifiers.

rust-analyzer.semanticHighlighting.operator.enable

type: boolean
default: True
Use semantic tokens for operators.

When disabled, rust-analyzer will emit semantic tokens only for operator tokens when they are tagged with modifiers.

rust-analyzer.semanticHighlighting.operator.specialization.enable

type: boolean
default: False
Use specialized semantic tokens for operators.

When enabled, rust-analyzer will emit special token types for operator tokens instead of the generic operator token type.

rust-analyzer.semanticHighlighting.punctuation.enable

type: boolean
default: False
Use semantic tokens for punctuation.

When disabled, rust-analyzer will emit semantic tokens only for punctuation tokens when they are tagged with modifiers or have a special role.

rust-analyzer.semanticHighlighting.punctuation.separate.macro.bang

type: boolean
default: False
When enabled, rust-analyzer will emit a punctuation semantic token for the ! of macro calls.

rust-analyzer.semanticHighlighting.punctuation.specialization.enable

type: boolean
default: False
Use specialized semantic tokens for punctuation.

When enabled, rust-analyzer will emit special token types for punctuation tokens instead of the generic punctuation token type.

rust-analyzer.semanticHighlighting.strings.enable

type: boolean
default: True
Use semantic tokens for strings.

In some editors (e.g. vscode) semantic tokens override other highlighting grammars. By disabling semantic tokens for strings, other grammars can be used to highlight their contents.

rust-analyzer.signatureInfo.detail

type: string
default: full
Show full signature of the callable. Only shows parameters if disabled.

possible values

value description
full Show the entire signature.
parameters Show only the parameters.

rust-analyzer.signatureInfo.documentation.enable

type: boolean
default: True
Show documentation.

rust-analyzer.typing.autoClosingAngleBrackets.enable

type: boolean
default: False
Whether to insert closing angle brackets when typing an opening angle bracket of a generic argument list.

rust-analyzer.workspace.symbol.search.kind

type: string
default: only_types
Workspace symbol search kind.

possible values

value description
only_types Search for types only.
all_symbols Search for all symbols kinds.

rust-analyzer.workspace.symbol.search.limit

type: integer
default: 128
minimum: 0
Limits the number of items returned from a workspace symbol search (Defaults to 128). Some clients like vs-code issue new searches on result filtering and don’t require all results to be returned in the initial search. Other clients requires all results upfront and might require a higher limit.

rust-analyzer.workspace.symbol.search.scope

type: string
default: workspace
Workspace symbol search scope.

possible values

value description
workspace Search in current workspace only.
workspace_and_dependencies Search in current workspace and dependencies.