Skip to content

Commit 679acf2

Browse files
authored
Merge pull request #476 from mre/fix/invalid-snippet-insert
Fix invalid snippet insertion when using "Find Inplace"
2 parents 0b3bb5e + e74aec7 commit 679acf2

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "snippet",
33
"displayName": "Snippet",
44
"description": "Insert a snippet from cht.sh for Python, JavaScript, Ruby, C#, Go, Rust (and any other language)",
5-
"version": "1.1.2",
5+
"version": "1.1.3",
66
"publisher": "vscode-snippet",
77
"engines": {
88
"vscode": "^1.74.0"

src/endpoints.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ export async function findWithProvider(
6262
});
6363
} else {
6464
const text = savedSnippetContent ? savedSnippetContent : doc.getText();
65-
const snippet = new vscode.SnippetString(text);
66-
const success = await editor.insertSnippet(snippet);
65+
const success = await editor.edit((builder) => {
66+
builder.insert(editor.selection.start, text);
67+
});
6768
if (!success) {
6869
vscode.window.showInformationMessage("Error while opening snippet.");
6970
}

0 commit comments

Comments
 (0)