refactor(lsp): span fix made easy by bumping lsp-textdocument to 0.4.2 (#15287)

# Description

The upstream crate fixed a bug of position calc, which made some extra
checking in lsp unnecessary.
Also moved some follow-up fixing of #15238 from #15270 here, as it has
something to do with previous position calc bug.

# User-Facing Changes

# Tests + Formatting

Adjusted

# After Submitting
This commit is contained in:
zc he
2025-03-11 19:13:58 +08:00
committed by GitHub
parent 2dab65f852
commit 81e496673e
5 changed files with 34 additions and 43 deletions

View File

@ -307,9 +307,8 @@ impl NuCompleter {
let need_externals = !prefix_str.contains(' ');
let need_internals = !prefix_str.starts_with('^');
let mut span = element_expression.span;
span.end = std::cmp::min(span.end, pos + 1);
if !need_internals {
span = Span::new(span.start + 1, span.end)
span.start += 1;
};
suggestions.extend(self.command_completion_helper(
working_set,