Skip to content

Commit

Permalink
feat(completion): support textEditText (#5253)
Browse files Browse the repository at this point in the history
  • Loading branch information
fannheyward authored Feb 6, 2025
1 parent baac60a commit 89cd1a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/completion/source-language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default class LanguageSource implements ISource<CompletionItem> {
let { character, line } = this.triggerContext
let pos = await getLineAndPosition(workspace.nvim)
if (pos.line != linenr - 1) return
let { textEdit, insertText, label } = item
let { textEdit, textEditText, insertText, label } = item
let range = getReplaceRange(item, this.itemDefaults, undefined, option.insertMode)
if (!range) {
// create default replace range
Expand All @@ -153,7 +153,7 @@ export default class LanguageSource implements ISource<CompletionItem> {
}
// replace range must contains cursor position.
if (range.end.character < character) range.end.character = character
let newText = textEdit ? textEdit.newText : insertText ?? label
let newText = textEdit ? textEdit.newText : (textEditText ? textEditText : insertText) ?? label
// adjust range by indent
let indentCount = fixIndent(line, pos.text, range)
// cursor moved count
Expand Down

0 comments on commit 89cd1a2

Please sign in to comment.