Skip to content

Commit a1d32cd

Browse files
author
Marc Jakobi
committed
fix(lsp): support completions for RustLsp with selection ranges
1 parent 1e7600b commit a1d32cd

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file.
66
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
77
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
## [Unreleased]
10+
11+
### Fixed
12+
13+
- LSP: Support completions for `RustLsp` with selection ranges.
14+
915
## [4.25.0] - 2024-06-16
1016

1117
### Added

lua/rustaceanvim/commands/init.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,17 +332,17 @@ function M.create_rust_lsp_command()
332332
bang = true,
333333
desc = 'Interacts with the rust-analyzer LSP client',
334334
complete = function(arg_lead, cmdline, _)
335-
local commands = cmdline:match('^' .. rust_lsp_cmd_name .. '!') ~= nil
335+
local commands = cmdline:match("^['<,'>]*" .. rust_lsp_cmd_name .. '!') ~= nil
336336
-- bang!
337337
and tbl_keys_by_value_filter(function(command)
338338
return command.bang == true
339339
end, rustlsp_command_tbl)
340340
or vim.tbl_keys(rustlsp_command_tbl)
341-
local subcmd, subcmd_arg_lead = cmdline:match('^' .. rust_lsp_cmd_name .. '[!]*%s(%S+)%s(.*)$')
341+
local subcmd, subcmd_arg_lead = cmdline:match("^['<,'>]*" .. rust_lsp_cmd_name .. '[!]*%s(%S+)%s(.*)$')
342342
if subcmd and subcmd_arg_lead and rustlsp_command_tbl[subcmd] and rustlsp_command_tbl[subcmd].complete then
343343
return rustlsp_command_tbl[subcmd].complete(subcmd_arg_lead)
344344
end
345-
if cmdline:match('^' .. rust_lsp_cmd_name .. '[!]*%s+%w*$') then
345+
if cmdline:match("^['<,'>]*" .. rust_lsp_cmd_name .. '[!]*%s+%w*$') then
346346
return vim.tbl_filter(function(command)
347347
return command:find(arg_lead) ~= nil
348348
end, commands)

0 commit comments

Comments
 (0)