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.serverPath
: Path to customrust-analyzer
executable, default:''
rust-analyzer.updates.channel
: Usestable
ornightly
updates, default:stable
rust-analyzer.diagnostics.enable
: Whether to show native rust-analyzer diagnostics, default:true
rust-analyzer.lruCapacity
: Number of syntax trees rust-analyzer keeps in memory, default:null
rust-analyzer.inlayHints.chainingHints
: Whether to show inlay type hints for method chains, Neovim Only, defaulttrue
rust-analyzer.files.watcher
: Controls file watching implementation, default:client
rust-analyzer.files.exclude
: Paths to exclude from analysis, default:[]
rust-analyzer.notifications.cargoTomlNotFound
: Whether to showcan't find Cargo.toml
error message, default:true
rust-analyzer.cargo.noDefaultFeatures
: Do not activate thedefault
feature, default:false
rust-analyzer.cargo.allFeatures
: Activate all available features, default:true
rust-analyzer.cargo.features
: List of features to activate, default:[]
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.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.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.callInfo.full
: Show function name and docs in parameter hints, default:true
rust-analyzer.trace.server
: Trace requests to server, default:off
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.applySourceChange
: Apply source changerust-analyzer.selectAndApplySourceChange
: Apply selected source changerust-analyzer.collectGarbage
: Run garbage collectionrust-analyzer.expandMacro
: Expand macro recursivelyrust-analyzer.joinLines
: Join linesrust-analyzer.matchingBrace
: Find matching bracerust-analyzer.parentModule
: Locate parent modulerust-analyzer.reload
: Restart rust-analyzer serverrust-analyzer.run
: List available runnables of current filerust-analyzer.runSingle
: Run runnable at positionrust-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.upgrade
: Download latestrust-analyzer
from GitHub release
CocRustChainingHint
: highlight name forchainingHints
, default link toCocHintSign
MIT
This extension is created by create-coc-extension