Skip to content

Commit c5127d4

Browse files
Kapil Borledaviwil
Kapil Borle
authored andcommitted
Insert a snippet instead of a string
1 parent f8c4b60 commit c5127d4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/features/HelpCompletion.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*--------------------------------------------------------*/
44

55
import { IFeature } from "../feature";
6-
import { TextDocumentChangeEvent, workspace, Disposable, Position, window, Range, EndOfLine } from "vscode";
6+
import { TextDocumentChangeEvent, workspace, Disposable, Position, window, Range, EndOfLine, SnippetString } from "vscode";
77
import { LanguageClient, RequestType } from "vscode-languageclient";
88

99
export namespace CommentHelpRequest {
@@ -53,6 +53,8 @@ export class HelpCompletionFeature implements IFeature {
5353

5454
onEvent(changeEvent: TextDocumentChangeEvent): void {
5555
// todo split this method into logical components
56+
// todo create a helpcompletion provider class
57+
// todo associate state with a given document
5658
let text = changeEvent.contentChanges[0].text;
5759
switch (this.searchState) {
5860
case SearchState.Searching:
@@ -109,7 +111,7 @@ export class HelpCompletionFeature implements IFeature {
109111

110112
// Trim the last empty line and join the strings.
111113
let text = content.slice(0, -1).join(this.getEOL(doc.eol));
112-
editor.edit(editBuilder => editBuilder.replace(replaceRange, text));
114+
editor.insertSnippet(new SnippetString(text), replaceRange);
113115
});
114116
}
115117
}

0 commit comments

Comments
 (0)