Skip to content

Commit 6d0a8ee

Browse files
committed
Workaround text_edit is present but new_text is empty.
Close #795. Note: this is not the correct way to go forward. Empty `new_text` is used to indicate remove range.
1 parent ce02a86 commit 6d0a8ee

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/types.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,9 @@ impl VimCompleteItem {
531531
let mut word = lspitem.insert_text.clone().unwrap_or_default();
532532
if word.is_empty() {
533533
match (lspitem.text_edit.clone(), complete_position) {
534-
(Some(text_edit), Some(complete_position)) => {
534+
(Some(ref text_edit), Some(complete_position))
535+
if !text_edit.new_text.is_empty() =>
536+
{
535537
// TextEdit range start might be different from vim expected completion start.
536538
// From spec, TextEdit can only span one line, i.e., the current line.
537539
if text_edit.range.start.character != complete_position {
@@ -544,7 +546,7 @@ impl VimCompleteItem {
544546
word = text_edit.new_text.clone();
545547
}
546548
}
547-
(Some(text_edit), _) => {
549+
(Some(ref text_edit), _) if !text_edit.new_text.is_empty() => {
548550
word = text_edit.new_text.clone();
549551
}
550552
(_, _) => {

0 commit comments

Comments
 (0)