summaryrefslogtreecommitdiff
path: root/extension/src/suggestions.ts
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-06-27 14:48:11 -0700
committerNate Sesti <sestinj@gmail.com>2023-06-27 14:48:11 -0700
commit4f0dfe2639affdd607488638d59af56b5b753aa8 (patch)
treea9af7c609132c47a92897162fd44d36c5f5d45b0 /extension/src/suggestions.ts
parent04015e77483ce2b9336f28e883693e93a746b7bb (diff)
downloadsncontinue-4f0dfe2639affdd607488638d59af56b5b753aa8.tar.gz
sncontinue-4f0dfe2639affdd607488638d59af56b5b753aa8.tar.bz2
sncontinue-4f0dfe2639affdd607488638d59af56b5b753aa8.zip
more streaming edge cases
Diffstat (limited to 'extension/src/suggestions.ts')
-rw-r--r--extension/src/suggestions.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/extension/src/suggestions.ts b/extension/src/suggestions.ts
index 209bf8b2..6e5f52ac 100644
--- a/extension/src/suggestions.ts
+++ b/extension/src/suggestions.ts
@@ -316,7 +316,7 @@ export async function showSuggestion(
(edit) => {
edit.insert(
new vscode.Position(range.end.line, 0),
- suggestion + "\n"
+ suggestion + (suggestion === "" ? "" : "\n")
);
},
{ undoStopBefore: false, undoStopAfter: false }
@@ -324,12 +324,11 @@ export async function showSuggestion(
.then(
(success) => {
if (success) {
+ const suggestionLinesLength =
+ suggestion === "" ? 0 : suggestion.split("\n").length;
let suggestionRange = new vscode.Range(
new vscode.Position(range.end.line, 0),
- new vscode.Position(
- range.end.line + suggestion.split("\n").length,
- 0
- )
+ new vscode.Position(range.end.line + suggestionLinesLength, 0)
);
const filename = editor!.document.uri.toString();