All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
5.14.1 (2024-11-12)
- compatibility with nvim-nightly (0b40190)
5.14.0 (2024-11-10)
5.13.2 (2024-11-09)
5.13.1 (2024-10-28)
5.13.0 (2024-10-17)
- remove corrupt file that breaks git clone on windows (ccff140)
5.12.0 (2024-10-15)
5.11.0 (2024-10-01)
5.10.1 (2024-09-27)
- windows: remove empty file causing git clone to fail (b7c8171)
5.10.0 (2024-09-27)
- add hint on how to configure/disable server status notifications (711e25f)
5.9.0 (2024-09-23)
5.8.1 (2024-09-21)
5.8.0 (2024-09-20)
- LSP: More information in unhealthy rust-analyzer notifications. Thanks @edevil!
- LSP: Notify if rust-analyzer is not healthy.
- Deprecate
rust-analyzer.json
in favour of.vscode/settings.json
or:h exrc
.
- When adding DAP configurations
(
vim.g.rustaceanvim.dap.autoload_configurations = true
, default), wait for compilation before spawning another process for the next compilation.
- Vim help docs: Actually include tags file.
- Vim help docs: Include tags.
- DAP: Use integrated terminal for lldb-dap by default Thanks @adonis0147!
- LSP: Copy settings to
init_options
when starting the client to match VSCode. Thanks @cormacrelf!
- UI:
nil
safety in codeAction Group. Thanks @dsully!
- Load rust-analyzer settings from
.vscode/settings.json
by default. Can be disabled by settingvim.g.rustaceanvim.server.load_vscode_settings
. This was introduced as an experimental feature in version 4.14.0.
- Health: Warn if no debug adapters have been detected.
- LSP (runnables/quickfix executor): Quickfix list populated with a single line.
- LSP (runnables/quickfix executor): Always add both
stdout
andstderr
to the quickfix list.
- DAP: Autoload new configurations in
on_attach
[#466].
- Neotest: One test failure caused all succeeding tests to be marked as failed when using cargo-nextest 0.9.7 [#460].
- Neotest: Disable ansi colour coding in output to ensure output can be parsed.
Rustc unpretty
: Support Windows.- Auto-detect the
rustc
edition. This deprecates thevim.g.rustaceanvim.tools.rustc.edition
option in favour ofvim.g.rustaceanvim.tools.rustc.default_edition
.
- LSP: Added colored ansi code diagnostic to floating and split windows
for
RustLsp renderDiagnostic
. Thanks @xzbdmw!
- Require Neovim
>= 0.10.0
. - Rename types in LuaCATS annotations and vimdoc.
- DAP: rust-analyzer removed the
cargoExtraArgs
field, which is a breaking change.
- LSP: Added optional
current
/cycle
arguments to theexplainError
andrenderDiagnostic
commands. No argument defaults tocycle
, which is current base behaviour.current
makes these functions only look for diagnostics in current cursor line Thanks @Rumi152!
- Testables: Default to
termopen
test executor if not usingneotest
- LSP: Support completions for
RustLsp
with selection ranges.
- LSP: If Neovim's file watcher is disabled, configure rust-analyzer to enable server-side file watching, unless it has been configured otherwise [#423].
- DAP: Dynamic library path setup using nightly rust builds
(stable
rustc
was always used due to a missingcwd
parameter). Thanks @morfnasilu! - DAP: Dynamic linking on macOS not working due to a typo in the
DYLD_LIBRARY_PATH
environment variable. Thanks @morfnasilu!
- Don't set deprecated
allFeatures
setting by default. Thanks @zjp-CN! - Error when decoding invalid JSON or blank string from cargo metadata.
- Config: Add a new
config.server.root_dir
option to override the root directory detection logic Thanks @bgw!
- LSP: Force-extend Neovim's default client capabilities with detected plugin capabilities, to ensure plugin capability extensions take precedence in case of conflict.
- LSP: Bug preventing rustaceanvim from loading
rust-analyzer.json
settings if there's no"rust-analyzer":
key.
- LSP: Error when editing a rust file in a directory that does not exist (#404).
- LSP/Clippy: use correct rust-analyzer config key,
check
instead ofcheckOnSave
, to enable clippy if detected. Thanks @Ryex!
- Executors/termopen:
<Esc>
to close buffer not silent. Thanks @b1nhack! - LSP: Only register
completionItem.snippetSupport
client capability when using Neovim >= 0.10.
- UI/Config: Don't override Neovim defaults in default
float_win_config
.
- Config: Open vertical splits from floating windows with
tools.float_win_config.open_split = 'vertical'
. Thanks @dwtong!
- Neotest: Remove unsupported
--show-output
flag when running with cargo-nextest.
- Update neovim nightly API call. If you are using neovim nightly, you need a build after May 04, 2024. Thanks @NicolasGB!
- LSP: Reuse client when viewing git dependencies [#374)]. Thanks @eero-lehtinen!
- LSP:
renderDiagnostic
andexplainError
skipped diagnostics if they were in the same location as other diagnostics. Thanks @LukeFranceschini! - LSP:
renderDiagnostic
andexplainError
stopped searching early and defaulted to the first diagnostic in the file, instead of the next diagnostic after the current cursor position. Thanks @LukeFranceschini!
- Update neovim nightly API call [#365]. If you are using neovim nightly, you need a build after April 19, 2024.
- UI:
float_win_config.border
not applied to code action group windows [#363].
- Neotest: Replace nightly API call with Neovim 0.9 API call (introduced in 4.22.1).
- Neotest: No tests found when getting root directory for a project directory.
- Neotest/DAP: Undo sanitize command for debugging when running with a non-dap strategy, in case it was sanitized during a dap strategy run.
- Neotest/DAP: multiple
--no-run
flags added to command when debugging multiple times [#357].
- Config: Customise group action icon with
tools.code_actions.group_icon
. Thanks @ColdMacaroni!
- Health: Report error if version check fails for a required
external dependency. This should help with false positives
when detecting
rust-analyzer
if the rustup wrapper is installed, butrust-analyzer
isn't.
- LSP:
renderDiagnostic
doesn't move cursor if it falls back to the first diagnostic when searching forwards.
- LSP: Support structural search and replace (SSR) just for the selected range.
- DAP/LSP:
tools.cargo_override
option to override thecargo
command for runnables/debuggables/testables.
- DAP/LSP:
RustLsp [run|debug]
commands for running/debugging targets at the current cursor position. - LSP: Join multiple visually selected lines with
:RustLsp joinLines
.
- LSP: Escape character inserted before
}
when applying code action withSnippetTextEdit
[#303].
- DAP: Output command that was run if debug build compilation fails.
- DAP: Add both
stderr
andstdout
to error message if debug build compilation fails.
:RustLsp openDocs
command [#325].
- LSP: Automatically detect and register client capabilities for the following plugins, if installed:
- Neotest: Correctly mark passed and skipped tests when running a whole test file or module [#321].
- DAP: Only load
.vscode/launch.json
configurations that don't conflict with the configured adapter type.
- Initialization: Warn if nvim-lspconfig.rust-analyzer setup is detected.
- LSP:
RustAnalyzer reloadSettings
command to reload settings without restarting [#309]. Thanks @GuillaumeLagrange!
- DAP: Defer automatic registration of nvim-dap configurations on LSP client init, to improve reliability.
- Health: rust-analyzer reported as not found in neovim 0.9 [#302].
- [Experimental] Load rust-analyzer settings from
.vscode/settings.json
. Can be enabled by settingvim.g.rustaceanvim.server.load_vscode_settings
totrue
[#286]. - Health: Detect rust-analyzer wrapper without rust-analyzer (Neovim >= 0.10).
- Config: Don't validate configs whose types are defined in external APIs such as nvim-dap [#294].
- DAP: Don't error if adding source/library information fails (warn instead).
- LSP/DAP: Fail silently if adding DAP configurations on LSP client attach fails [#295].
- LSP: More flexibility when overriding default rust-analyzer settings.
The
server.settings
function can now take adefault_settings
tabe to be merged.
- Loading settings from
rust-analyzer.json
: Potential for duplicate lua config keys if json keys are of the format:"rust-analyzer.foo.bar"
- LSP/Windows: path normalisation preventing lsp from working
textDocument/definition
to std library [#285]. Thanks @tangtang95!
- UI: Buggy concealing of elements in rendered diagnostics [#280].
- LSP: Use file directory name as cwd when getting cargo metadata. This prevents rustaceanvim from detecting the wrong project root in standalone files if the current cwd is a cargo project.
- DAP:
:RustLsp! debuggables
not falling back to UI select when no debuggable is found.
- LSP: Support falling back to UI select for
:RustLsp! runnables
and:RustLsp! testables
.
- LSP/Windows: Windows path normalisation preventing LSP client from working [#273].
- LSP: By default, don't auto-attach to buffers that aren't files [#268].
- LSP: Bug preventing reload workspace on save Cargo.toml when opening another Rust buffer [#270].
- LSP: Don't try to delete
RustLsp
command on client exit if it doesn't exist, and fail silently.
- LSP: Schedule Neovim API calls on
on_exit
[#267]. Thanks @tomtomjhj!
- UI: Explicitly disable signcolumn for grouped code action and hover action windows [#262].
- LSP/Grouped code actions: Add
<ESC>
keymap to close buffer. This is consistent with the behaviour of the hover actions buffer.
- Nix:
codelldb
adapter package (without the vscode extension) as a nixpkgs overlay and a flake output.
- Don't run
ftplugin/rust.lua
more than once on the same buffer. This prevented the client from reattaching when running:e
on a buffer [#250].
- Neotest: Expose doctests in
:Neotest summary
window [#247]. Thanks @bltavares!
- Testables: Run doctests when cargo-nextest is present [#246] Thanks @bltavares!
- Windows: Normalize file actions when comparing to root dir [#245]. Thanks @bltavares!
- DAP: Use deep copies of dap configs.
- DAP: Bad config validation:
dap.configuration.env
should be atable
, not astring
.
- LSP: Support both top-level rust-analyzer object and object with
"rust-analyzer":
key when importing settings fromrust-analyzer.json
. The fix introduced in version 4.6.0 had accidentally broken backward compatibility. The new implementation is backward compatible again.
- LSP: Error when running
reloadWorkspace
,rebuildMacros
orworkspaceSymbol
from a non-rust buffer [#234]. - Internal: Don't pass client not found error to handler.
- DAP(
codelldb
): Redirectstdio
(stdout
) to a temp file.
- LSP:
checkOnSave = false
not respected when clippy is installed (introduced with clippy auto-detection in version4.6.0
).
- Testables: Add
tools.crate_test_executor
option for running crate test suites (--all-targets
). - Rustc: Do not require a main function,
and support the 2024 edition
via
unstable-options
. Thanks @saying121!
- Neotest: Nested modules + position updates when switching buffers [#223]. Thanks @jameshurst!
- Testables: Support
neotest
executor when usingnextest
. - Testables: Support aliases for
test_executor
andcrate_test_executor
.
- LSP: New
tools.enable_clippy
option (defaults totrue
). Enable clippy lints on save if acargo-clippy
installation is detected.
- testables/neotest: Don't use nextest if disabled in the config.
- LSP: load project-local rust-analyzer.json configs into
server['rust-analyzer']
, instead of replacing theserver
config.
- runnables/debuggables/testables:
cd
into directory with spaces [#212].
- LSP: Notify if an LSP request was made but no rust-analyzer client is attached.
- Neotest: Only the current buffer was queried for test positions.
- Filtered workspace symbol searches with
:RustLsp[!] workspaceSymbol [onlyTypes?|allSymbols?] [query?]
. Will include dependencies if called with a bang!
. - Neotest: Basic support for
require('neotest').run.run { suite = true }
. This will run the current crate's test suite, if detected. Note that positions are still only discovered for buffers with an attached LSP client.
- You can now register a
rustaceanvim.neotest
adapter with neotest. It will query rust-analyzer for test positions and test commands in any buffer to which the LSP client is attached. If you do so,tools.test_executor
will default to a new'neotest'
executor, which will use neotest to runtestables
orrunnables
that are tests. - Support for
require('neotest').run.run { strategy = 'dap' }
. This will use the same logic as:RustLsp debuggables
to set neotest's DAP strategy. No extra configuration needed! :RustLsp testables
: Prettier selection options.
- DAP(
codelldb
): Redirectstdio
(stdout
) to a temp file.
- LSP: Improved parsing of test result failure messages.
- LSP: Only advertise
rust-analyzer.debugSingle
command capability if nvim-dap is installed. - LSP:
nil
error if running:RustLsp! testables
and there is no previous testable. - LSP: Update previous testables cache if executing a
rust-analyzer.runSingle
command that is a test.
- Config: Separate
tools.executor
andtools.test_executor
options. Thetest_executor
is used for test runnables (e.g.cargo test
). - LSP: New test executor,
'background'
that runs tests in the background and provides diagnostics for failed tests when complete. Used by default in Neovim >= 0.10. - LSP:
:RustLsp testables
command, which is equivalent to:RustLsp runnables
, but filters the runnables for tests only,
Important
In Neovim < 0.10, 'background'
executor blocks the UI while running tests.
:Rustc unpretty
command: Userustc -Z unpretty=[mir|hir|...]
to inspect mir and other things, and achieve an experience similar to Rust Playground. (currently requires a nightly compiler). Thanks saying121!- Config:
tools.rustc
arguments forrustc
.
- Improved command completions.
- Filter suggested subcommand arguments based on existing user input.
- When calling,
:RustLsp!
, show only subcommands that change behaviour with a bang.
- Command completions: Removed completions
for
runnables/debuggables last
.
renderDiagnostic
: Window closes immediately ifauto_focus
is disabled [#193].explainError
/renderDiagnostic
: Fall back to first detected diagnostic if none is found close to the cursor.
- LSP (standalone): Use
bufnr
passed intolsp.start
function when determining detached file name.
- LSP: Fix resetting client state on
:RustAnalyzer stop
if only one client is attached.
- Only setup
vim.lsp.commands
for rust-analyzer on the first initialization. - Don't run
ftplugin/rust.lua
more than once on the same buffer.
- To run the previous runnable/debuggable, you would call
:RustLsp runnables last
or:RustLsp debuggables last
. These two functions now take optional arguments that you can pass to the executables. The new way to run the previous runnable/debuggable is with a bang (!
). e.g.:RustLsp! debuggables
. In Lua, this isvim.cmd.RustLsp { 'debuggables', bang = true }
, and the same for'runnables'
.
- LSP: Option to fall back to
vim.ui.select
if there are no code action groups when running:RustLsp codeAction
. - LSP/DAP: Allow overriding executable args with
:RustLsp runnables args[]
and:RustLsp debuggables args[]
.
- LSP: Focus lost when secondary float opens on
:RustLsp codeAction
[#169].
- DAP:
nil
safety in standalone files [#182].
- LSP: Properly sanitize hover actions debug command [#179]. Thanks @Tired-Fox!
- Spawn rust-analyzer in detached mode when no project root is found. This adds support for standalone files without a Rust project.
- Cache runnables and debuggables run with commands/code lenses.
- Performance (DAP): Use cached source map, LLDB commands and library path.
- DAP: Set
autoload_configurations
only for Neovim >= 0.10, as compiling the debug build is not async in Neovim 0.9.
- DAP:
nil
error when executingrust-analyzer.debugSingle
or:RustLsp debuggables last
commands (introduced in 3.16.0).
- DAP: Improve reliability of loading Rust debug configurations on LSP attach.
- DAP: Assign
lldb
andcodelldb
configurations found inlaunch.json
todap.configurations.rust
.
- DAP: Better
nvim-dap
integration: Automatically try to load Rust debug configurations on LSP attach. This lets you userequire('dap').continue()
instead of:RustLsp debuggables
, once the configurations have been loaded. Can be disabled by settingvim.g.rustaceanvim.dap.autoload_configurations = false
.
- LSP: If inlay hints are enabled for a buffer, force Neovim to redraw them when rust-analyzer has fully initialized. This is a workaround for neovim/26511.
- LSP: On client stop, reset the
experimental/serverStatus
handler's internal state for the respective client, so that the handler can be rerun on restart. - LSP/Windows: Normalize case sensitive
root_dir
[#151]. Thanks @TrungNguyen153!
:RustAnalyzer restart
command.- Smarter completions for
:RustAnalyzer
commands.- Only suggest
start
command if there is no active client for the current buffer - Only suggest
stop
andrestart
if there is an active client for the current buffer
- Only suggest
:RustLsp renderDiagnostic
command: Render diagnostics as displayed duringcargo build
.- Add
Open in split
action toexplainError
andrenderDiagnostic
float preview windows.
- DAP: Use
codelldb
adapter nvim-dap field when usingcodelldb
.
- Config:
tools.float_win_config
for all floating Windows created by this plugin. Movedborder
,max_width
,max_height
,auto_focus
fromhover_actions
tofloat_win_config
. Thehover_actions
window options are still applied if they exist, so as not to break compatibility. Thanks @saying121!
- DAP: Don't load
lldb_commands
when usingcodelldb
. - DAP: Make sure the client configuration type is 'codelldb' when using a 'codelldb' adapter.
- LSP: Don't set
augmentsSyntaxTokens
capability. This appears to cause problems for some colorschemes.
- Config: Report error if new validations fail.
- Config: Some more validations.
- SSR: Make query optional.
- Health: Only report error if
lspconfig.rust_analyzer
has been setup, not other lspconfig configurations.
- SSR: Broken when command contains spaces [#104].
- LSP: Prevent "attempt to index a
nil
value" error [#105].
- Health: Don't eagerly import modules.
- DAP: Only add sourceMap and lldb commands if the files exist.
- DAP (Windows): Fixed .exe extension in mason.nvim codelldb detection. Thanks @svermeulen!
- DAP: Check if mason dap package is installed [#96]. Thanks @richchurcher!
Thanks @Andrew Collins:
- DAP: Load the
dap.adapter
config value into thelldb
adapter, but only if thelldb
adapter is not already configured. - DAP: Add
dap.configuration
entry to config with the default behaviour of loadinglaunch.json
, or falling back to a basic configuration of thelldb
adapter.- Use the
dap.configuration
config value to configure the debug session, falling back to therust
configuration.
- Use the
- DAP: Support
probe-rs
.
nil
checks for when there is no root project. Fixes the error message encountered in #90.
:RustLsp flyCheck
: Typo in LSP client request, causing the command to do nothing [#88].
- DAP: mason.nvim
codelldb
installation detection - liblldb path.
- DAP: Typo in mason.nvim
codelldb
installation detection (╯°□°)╯︵ ┻━┻.
- DAP:
loop error
when auto-detecting mason.nvimcodelldb
installation. - DAP: Deprecate
require('rustaceanvim.dap').get_codelldb_adapter
(replaced withrequire('rustaceanvim.config').get_codelldb_adapter
).
- DAP: Potential bug when loading mason.nvim's
codelldb
package. - DAP: Check that mason.nvim's
codelldb
package isn'tnil
before using it.
- DAP: Auto-detect
codelldb
if it is installed via mason.nvim.
:RustLsp logFile
command, which opens the rust-analyzer log file.:RustLsp flyCheck
: Supportrun
,clear
andcancel
subcommands.- Executors: Support commands without
cwd
.
- Health: Check if
vim.g.rustaceanvim
is set, but hasn't been sourced before initialization.
- DAP: Correctly format environment, so that it works with both
codelldb
andlldb
[#74]. Thanks @richchurcher!
- DAP: Support dynamically compiled executables [[#64]#64).
Thanks @richchurcher!
- Configures dynamic library paths by default (with the ability to disable)
- Loads Rust type information by default (with the ability to disable).
- DAP: Format
sourceMap
correctly for bothcodelldb
andlldb
.codelldb
expects a map, whilelldb
expects a list of tuples.
- Completion for
:RustLsp hover actions
command suggestingaction
.
- DAP: Source map should be a list of tuples, not a map.
- DAP:
lldb-vscode
andlldb-dap
executable detection.
- DAP: Add support for
lldb-dap
, which has been renamed tolldb-vscode
, but may still have the old name on some distributions.
- Broken
:RustLsp runnables last
command [#62].
- Add
tools.open_url
option, to allow users to override how to open external docs.
- Config validation fails if
server.settings
option is a table [#56].
- Ability to load rust-analyzer settings from project-local JSON files.
- Open external docs broken in Neovim 0.9 [#50].
- Command completion broken in Neovim 0.9 [#47].
- Auto-create
codelldb
configurations.
- DAP: Support
codelldb
configurations [#40]. - DAP: Don't pass in an empty source map table if the
auto_generate_source_map
setting evaluates tofalse
.
- Default rust-analyzer configuration [#37]. Thanks again, @eero-lehtinen!
- Cargo workspace reload using removed command [#36]. Thanks @eero-lehtinen!
- Neovim 0.9 compatibility layer: Missing
nil
checks [#32].
- DAP: Auto-generate source map, to allow stepping into
std
.
dap
/quickfix
executor: Fix settingcwd
for shell commands.
- Completions for
:RustLsp
subcommands' arguments.
- Removed
plenary.nvim
dependency (dap
andquickfix
executor). This plugin now has noplenary.nvim
dependencies left. NOTE: As this does not lead to a bump in the minimal requirements, this is not a breaking change.
- Remove accidental use of Neovim nightly API
(
dap
,crateGraph
,explainError
) [#26]. - Add static type checking for Neovim stable API.
:RustLsp explainError
command, usesrustc --explain
on error diagnostics with an error code.:RustLsp rebuildProcMacros
command.
- Health check got stuck if
lldb-vscode
was installed.
- Allow
:RustLsp hover range
to accept a range. - Fix
:RustLsp crateGraph
passing arguments as list.
- Potential attempt to index
nil
upvalue when sendingworkspace/didChangeWorkspaceFolders
to LSP server [#22].
- Hover actions: Tree-sitter syntax highlighting in Neovim 0.9 [#20].
- Add support for
workspace/didChangeWorkspaceFolders
to prevent more than one rust-analyzer server from spawning per Neovim instance [#7]. - Neovim 0.9 compatibility [#9].
- Renamed this plugin to
rustaceanvim
, to avoid potential clashes withvxpm/ferris.nvim
,vxpm/ferris.nvim
was created just before I renamed my fork (but after I had checked the web for name clashes (╯°□°)╯︵ ┻━┻).
- Open external docs: Use
xdg-open
oropen
(MacOS) by default and fall back tonetrw
. Remove redundant URL encoding.
- Add a
vim.g.rustaceanvim.server.auto_attach
option, which can be aboolean
or afun():boolean
that determines whether or not to auto-attach the LSP client when opening a Rust file.
- [Internal] Type safety in
RustLsp
command construction. This fixes a type error in thehover
command validation. - Failure to start on standalone files if
cargo
is not installed.
- Don't pollute the command space:
Use a single command with subcommands and completions.
RustAnalyzer [start|stop]
(always available in Rust projects)RustLsp [subcommand]
(available when the LSP client is running) e.g.RustLsp moveItem [up|down]
- Hover actions + command cache: module requires.
- Initial release of
rustaceanvim
. :RustSyntaxTree
and:RustFlyCheck
commands.:RustAnalyzerStart
and:RustAnalyzerStop
commands.- Config validation.
- Health checks (
:checkhealth rustaceanvim
). - Vimdocs (auto-generated from Lua docs -
:help rustaceanvim
). - Nix flake.
- Allow
tools.executor
to be a string. - LuaRocks releases.
- Minimal config for troubleshooting.
- Added type annotations.
- Nix CI and linting infrastructure and static type checking.
- Lazy load command modules.
- Numerous potential bugs encountered during rewrite.
- Erroneous semantic token highlights.
- Make sure we only send LSP requests to the correct client.
- Removed the
setup
function and revamped the architecture to be less prone to type errors. This plugin is a filetype plugin and works out of the box. The default configuration should work for most people, but it can be configured with avim.g.rustaceanvim
table. - Removed the
lspconfig
dependency. This plugin now uses the built-in LSP client API. You can use:RustAnalyzerStart
and:RustAnalyzerStop
to manually start/stop the LSP client. This plugin auto-starts the client when opening a rust file, if therust-analyzer
binary is found. - Removed
rt = require('rust-tools')
table. You can access the commands using Neovim'svim.cmd
Lua bridge, for example[This has changed! See above.].:lua vim.cmd.RustSSR()
or:RustSSR
- Bumped minimum Neovim version to
0.9
. - Removed inlay hints, as this feature will be built into Neovim
0.10
.