rust-analyzer for Vim/Neovim, works as an extension with coc.nvim.
:CocInstall coc-rust-analyzer
remove
rust-analyzer
config fromcoc-settings.json
if 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
.
rust-analyzer.enable
: Enable coc-rust-analyzer extension, defaulttrue
rust-analyzer.server.path
: Path to customrust-analyzer
executable, default:''
rust-analyzer.updates.prompt
: Prompt the user before downloading, default:true
rust-analyzer.updates.channel
: Usestable
ornightly
updates, default:stable
rust-analyzer.diagnostics.enable
: Whether to show native rust-analyzer diagnostics, default:true
rust-analyzer.diagnostics.enableExperimental
: Whether to show experimental rust-analyzer diagnostics that might have more false positives than usual, default:true
rust-analyzer.diagnostics.disabled
: List of rust-analyzer diagnostics to disable, default:[]
rust-analyzer.diagnostics.warningsAsInfo
: List of warnings that should be displayed with info severity, default:[]
rust-analyzer.diagnostics.warningsAsHint
: List of warnings that should be displayed with hint severity, default:[]
rust-analyzer.lruCapacity
: Number of syntax trees rust-analyzer keeps in memory, default:null
rust-analyzer.inlayHints.enable
: Whether to show inlay hints, defaulttrue
rust-analyzer.inlayHints.typeHints
: Whether to show inlay type hints for variables, Neovim Only, defaulttrue
rust-analyzer.inlayHints.typeHintsSeparator
: Separator text for typeHints in virtual text, default‣
rust-analyzer.inlayHints.chainingHints
: Whether to show inlay type hints for method chains, Neovim Only, defaulttrue
rust-analyzer.inlayHints.chainingHintsSeparator
: Separator text for chainingHints in virtual text, default‣
rust-analyzer.inlayHints.refreshOnInsertMode
: Whether to refresh inlayHints on insert mode, defaultfalse
rust-analyzer.files.watcher
: Controls file watching implementation, default:client
rust-analyzer.notifications.cargoTomlNotFound
: Whether to showcan't find Cargo.toml
error message, default:true
rust-analyzer.cargo.autoreload
: Automatically refresh project info viacargo metadata
on Cargo.toml changes, default:true
rust-analyzer.cargo.allFeatures
: Activate all available features, default:false
rust-analyzer.cargo.features
: List of features to activate, default:[]
rust-analyzer.cargo.noDefaultFeatures
: Do not activate thedefault
feature, default:false
rust-analyzer.cargo.loadOutDirsFromCheck
: Runcargo check
on startup to get the correct value for package OUT_DIRs, default:false
rust-analyzer.procMacro.enable
: Enable Proc macro support,cargo.loadOutDirsFromCheck
must be enabled, default:false
rust-analyzer.rustfmt.extraArgs
: Additional arguments to rustfmt, default:[]
rust-analyzer.rustfmt.overrideCommand
: Advanced option, fully override the command rust-analyzer uses for formatting, default:null
rust-analyzer.checkOnSave.enable
: Run specifiedcargo check
command for diagnostics on save, default:true
rust-analyzer.checkOnSave.target
: Check for a specific target.rust-analyzer.checkOnSave.extraArgs
: Extra arguments forcargo check
, default:[]
rust-analyzer.checkOnSave.command
: Cargo command to use forcargo check
, default:check
rust-analyzer.checkOnSave.overrideCommand
: Advanced option, fully override the command rust-analyzer uses for checking. The command should include--message=format=json
or similar option, default:null
rust-analyzer.checkOnSave.allTargets
: Check all targets and tests (will be passed as--all-targets
), default:true
rust-analyzer.checkOnSave.noDefaultFeatures
: Do not activate thedefault
featurerust-analyzer.checkOnSave.allFeatures
: Check with all features (will be passed as--all-features
), default:null
rust-analyzer.checkOnSave.features
: List of features to activate, default:null
rust-analyzer.completion.addCallParenthesis
: Whether to add parenthesis when completing functions, default:true
rust-analyzer.completion.addCallArgumentSnippets
: Whether to add argument snippets when completing functions, default:true
rust-analyzer.completion.postfix.enable
: Whether to show postfix snippets likedbg
,if
,not
, etc, default:true
rust-analyzer.lens.enable
: Whether to show CodeLens in Rust files, default:true
rust-analyzer.lens.run
: Whether to show Run lens, default:true
rust-analyzer.lens.implementations
: Whether to show Implementations lens, default:true
rust-analyzer.lens.methodReferences
: Whether to showMethod References
lens, default:false
rust-analyzer.hoverActions.linksInHover
: Whether to show document links in hover, default:false
rust-analyzer.callInfo.full
: Show function name and docs in parameter hints, default:true
rust-analyzer.trace.server
: Trace requests to server, default:off
rust-analyzer.debug.runtime
: Which runtime debug to use, default:termdebug
, options:vimspector
,termdebug
rust-analyzer.debug.vimspector.configuration.name
: The name of the vimspector configuration. The following variables will be passed to the configuration:Executable
andArgs
. Make sure to add them to the configuration
Settings not specific to rust-analyzer
can be found at :help coc-configuration
.
You can use these commands by :CocCommand XYZ
.
rust-analyzer.analyzerStatus
: Show rust-analyzer statusrust-analyzer.expandMacro
: Expand macro recursivelyrust-analyzer.joinLines
: Join linesrust-analyzer.matchingBrace
: Find matching bracerust-analyzer.memoryUsage
: Memory Usage (Clears Database)rust-analyzer.openDocs
: Open docs under cursorrust-analyzer.parentModule
: Locate parent modulerust-analyzer.reload
: Restart rust-analyzer serverrust-analyzer.reloadWorkspace
: Reload workspacerust-analyzer.run
: List available runnables of current filerust-analyzer.syntaxTree
: Show syntax treerust-analyzer.ssr
: Structural Search Replacerust-analyzer.serverVersion
: Show current Rust Analyzer server versionrust-analyzer.toggleInlayHints
: Toggle inlay hints on/offrust-analyzer.explainError
: Explain the currently hovered error messagerust-analyzer.viewHir
: View Hirrust-analyzer.upgrade
: Download latestrust-analyzer
from GitHub release
CocRustTypeHint
: highlight name fortypeHints
, default link toCocHintSign
CocRustChainingHint
: highlight name forchainingHints
, default link toCocHintSign
If this extension is helpful to you, please support me via Patreon or PayPal:
MIT
This extension is created by create-coc-extension