rust-analyzer extension for coc.nvim
rust-analyzer for Vim/Neovim, works as an extension with coc.nvim.
:CocInstall coc-rust-analyzer
remove
rust-analyzerconfig fromcoc-settings.jsonif you set
This extension is configured using a jsonc file. You can open this configuration file using the command
:CocConfig, and it is typically located at
$HOME/.config/nvim/coc-settings.json.
| Configuration | Description | Default | | -- | -- | -- | |
rust-analyzer.enable| Enable coc-rust-analyzer extension |
true| |
rust-analyzer.server.path| Path to custom
rust-analyzerexecutable |
''| |
rust-analyzer.updates.prompt| Prompt the user before downloading |
true| |
rust-analyzer.updates.channel| Use
stableor
nightlyupdates |
stable| |
rust-analyzer.diagnostics.enable| Whether to show native rust-analyzer diagnostics |
true| |
rust-analyzer.diagnostics.enableExperimental| Whether to show experimental rust-analyzer diagnostics that might have more false positives than usual |
true| |
rust-analyzer.diagnostics.disabled| List of rust-analyzer diagnostics to disable |
[]| |
rust-analyzer.diagnostics.warningsAsInfo| List of warnings that should be displayed with info severity |
[]| |
rust-analyzer.diagnostics.warningsAsHint| List of warnings that should be displayed with hint severity |
[]| |
rust-analyzer.lruCapacity| Number of syntax trees rust-analyzer keeps in memory |
null| |
rust-analyzer.inlayHints.enable| Whether to show inlay hints |
true| |
rust-analyzer.inlayHints.typeHints| Whether to show inlay type hints for variables, Neovim Only |
true| |
rust-analyzer.inlayHints.typeHintsSeparator| Separator text for typeHints in virtual text |
‣| |
rust-analyzer.inlayHints.chainingHints| Whether to show inlay type hints for method chains, Neovim Only |
true| |
rust-analyzer.inlayHints.chainingHintsSeparator| Separator text for chainingHints in virtual text |
‣| |
rust-analyzer.inlayHints.refreshOnInsertMode| Whether to refresh inlayHints on insert mode |
false| |
rust-analyzer.files.watcher| Controls file watching implementation |
client| |
rust-analyzer.notifications.cargoTomlNotFound| Whether to show
can't find Cargo.tomlerror message |
true| |
rust-analyzer.cargo.autoreload| Automatically refresh project info via
cargo metadataon Cargo.toml changes |
true| |
rust-analyzer.cargo.allFeatures| Activate all available features |
false| |
rust-analyzer.cargo.features| List of features to activate |
[]| |
rust-analyzer.cargo.noDefaultFeatures| Do not activate the
defaultfeature |
false| |
rust-analyzer.cargo.loadOutDirsFromCheck| Run build scripts (
build.rs) for more precise code analysis |
false| |
rust-analyzer.procMacro.enable| Enable support for procedural macros, implies
#rust-analyzer.cargo.runBuildScripts#|
false| |
rust-analyzer.rustfmt.extraArgs| Additional arguments to rustfmt |
[]| |
rust-analyzer.rustfmt.overrideCommand| Advanced option, fully override the command rust-analyzer uses for formatting |
null| |
rust-analyzer.checkOnSave.enable| Run specified
cargo checkcommand for diagnostics on save |
true| |
rust-analyzer.checkOnSave.target| Check for a specific target |
null| |
rust-analyzer.checkOnSave.extraArgs| Extra arguments for
cargo check|
[]| |
rust-analyzer.checkOnSave.command| Cargo command to use for
cargo check|
check| |
rust-analyzer.checkOnSave.overrideCommand| Advanced option, fully override the command rust-analyzer uses for checking. The command should include
--message=format=jsonor similar option |
null| |
rust-analyzer.checkOnSave.allTargets| Check all targets and tests (will be passed as
--all-targets) |
true| |
rust-analyzer.checkOnSave.noDefaultFeatures| Do not activate the
defaultfeature |
null| |
rust-analyzer.checkOnSave.allFeatures| Check with all features (will be passed as
--all-features) |
null| |
rust-analyzer.checkOnSave.features| List of features to activate |
null| |
rust-analyzer.completion.addCallParenthesis| Whether to add parenthesis when completing functions |
true| |
rust-analyzer.completion.addCallArgumentSnippets| Whether to add argument snippets when completing functions |
true| |
rust-analyzer.completion.postfix.enable| Whether to show postfix snippets like
dbg,
if,
not, etc |
true| |
rust-analyzer.completion.autoimport.enable| Whether to enable additional completions that automatically add imports when completed |
true| |
rust-analyzer.lens.enable| Whether to show CodeLens in Rust files |
true| |
rust-analyzer.lens.run| Whether to show Run lens |
true| |
rust-analyzer.lens.implementations| Whether to show Implementations lens |
true| |
rust-analyzer.lens.methodReferences| Whether to show
Method Referenceslens |
false| |
rust-analyzer.hoverActions.linksInHover| Whether to show document links in hover |
false| |
rust-analyzer.assist.importMergeBehavior| The strategy to use when inserting new imports or merging imports |
full| |
rust-analyzer.assist.importPrefix| The path structure for newly inserted paths to use |
plain| |
rust-analyzer.assist.importGroup| Group inserted imports by the following order. Groups are separated by newlines |
true| |
rust-analyzer.callInfo.full| Show function name and docs in parameter hints |
true| |
rust-analyzer.trace.server| Trace requests to server |
off| |
rust-analyzer.debug.runtime| Which runtime debug to use, options:
vimspector,
termdebug|
termdebug| |
rust-analyzer.debug.vimspector.configuration.name| The name of the vimspector configuration. The following variables will be passed to the configuration
Executableand
Args. Make sure to add them to the configuration |
launch|
Settings not specific to
rust-analyzercan be found at
:help coc-configuration.
You can use these commands by
:CocCommand XYZ.
| Command | Description | | -- | -- | | rust-analyzer.analyzerStatus | Show rust-analyzer status | | rust-analyzer.expandMacro | Expand macro recursively | | rust-analyzer.explainError | Explain the currently hovered error message | | rust-analyzer.joinLines | Join lines | | rust-analyzer.matchingBrace | Find matching brace | | rust-analyzer.memoryUsage | Memory Usage (Clears Database) | | rust-analyzer.moveItemUp | Move item up | | rust-analyzer.moveItemDown | Move item down | | rust-analyzer.openDocs | Open docs under cursor | | rust-analyzer.parentModule | Locate parent module | | rust-analyzer.peekTests | Peek related tests | | rust-analyzer.reload | Restart rust-analyzer server | | rust-analyzer.reloadWorkspace | Reload workspace | | rust-analyzer.run | List available runnables of current file | | rust-analyzer.serverVersion | Show current Rust Analyzer server version | | rust-analyzer.ssr | Structural Search Replace | | rust-analyzer.syntaxTree | Show syntax tree | | rust-analyzer.toggleInlayHints | Toggle inlay hints on/off | | rust-analyzer.upgrade | Download latest
rust-analyzerfrom GitHub release | | rust-analyzer.viewHir | View Hir |
CocRustTypeHint: highlight name for
typeHints, default link to
CocHintSign
CocRustChainingHint: highlight name for
chainingHints, default link to
CocHintSign
If this extension is helpful to you, please support me via Patreon or PayPal:
<!-- markdownlint-disable-next-line -->
MIT
This extension is created by create-coc-extension