Skip to content

Commit

Permalink
fix(lsp): only advertise debugSingle capability if nvim-dap is found
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Jan 30, 2024
1 parent 7c63115 commit 259dbb7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- LSP: Only advertise `rust-analyzer.debugSingle` command capability
if nvim-dap is installed.

## [4.2.0] - 2024-01-30

### Added

- Config: Separate `tools.executor` and `tools.test_executor` options.
The `test_executor` is used for test runnables (e.g. `cargo test`).
- LSP: New test executor, `'background'` that runs tests in the background
Expand Down
18 changes: 11 additions & 7 deletions lua/rustaceanvim/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,18 @@ M.start = function(bufnr)
}

-- rust analyzer goodies
local experimental_commands = {
'rust-analyzer.runSingle',
'rust-analyzer.showReferences',
'rust-analyzer.gotoLocation',
'editor.action.triggerParameterHints',
}
if package.loaded['dap'] ~= nil then
table.insert(experimental_commands, 'rust-analyzer.debugSingle')
end

capabilities.experimental.commands = {
commands = {
'rust-analyzer.runSingle',
'rust-analyzer.debugSingle',
'rust-analyzer.showReferences',
'rust-analyzer.gotoLocation',
'editor.action.triggerParameterHints',
},
commands = experimental_commands,
}

lsp_start_config.capabilities = vim.tbl_deep_extend('force', capabilities, lsp_start_config.capabilities or {})
Expand Down

0 comments on commit 259dbb7

Please sign in to comment.