Skip to content

Commit

Permalink
replace text before multline
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmacarthy committed Mar 26, 2024
1 parent 73ae8cc commit 21355d6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/extension/providers/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,13 @@ export class CompletionProvider implements InlineCompletionItemProvider {
return ''
}

const lineText = getCurrentLineText(this._position)
const lineTextLength = lineText.trim().length

if (!this._parser) return

const completionTree = this._parser.parse(
this.removeStopWords(this._completion)
this.removeStopWords(`${lineText}${this._completion}`)
)

if (!completionTree) return ''
Expand All @@ -257,7 +260,7 @@ export class CompletionProvider implements InlineCompletionItemProvider {
const node = completionNode.children[0]

if (lineBreakCount >= minLineBreaks && !node.hasError) {
return node.text
return node.text.slice(lineTextLength)
}

return ''
Expand Down

0 comments on commit 21355d6

Please sign in to comment.