From 3774dd3ace10ca85dead9a25251898f2754c0e0f Mon Sep 17 00:00:00 2001 From: VladBrok Date: Sun, 5 Nov 2023 21:27:53 +0300 Subject: [PATCH] remove usage of vscode.SnippetString because it results in invalid answer insertion --- package-lock.json | 4 ++-- package.json | 2 +- src/endpoints.ts | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index a857f6ce..56ad8bf8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "snippet", - "version": "1.1.2", + "version": "1.1.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "snippet", - "version": "1.1.2", + "version": "1.1.3", "license": "MIT", "dependencies": { "@vscode/vsce": "^2.22.0", diff --git a/package.json b/package.json index ac070de8..a7f229bf 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "snippet", "displayName": "Snippet", "description": "Insert a snippet from cht.sh for Python, JavaScript, Ruby, C#, Go, Rust (and any other language)", - "version": "1.1.2", + "version": "1.1.3", "publisher": "vscode-snippet", "engines": { "vscode": "^1.74.0" diff --git a/src/endpoints.ts b/src/endpoints.ts index 5010286a..aa304da0 100644 --- a/src/endpoints.ts +++ b/src/endpoints.ts @@ -62,8 +62,9 @@ export async function findWithProvider( }); } else { const text = savedSnippetContent ? savedSnippetContent : doc.getText(); - const snippet = new vscode.SnippetString(text); - const success = await editor.insertSnippet(snippet); + const success = await editor.edit((builder) => { + builder.insert(editor.selection.start, text); + }); if (!success) { vscode.window.showInformationMessage("Error while opening snippet."); }