Skip to content

Commit 55e2720

Browse files
authored
lightspeed: ensure completion doesn't finish with a \n (#2138)
Not clear yet why, but when the prediction ends with a `\n` and we are at the top of a short file, the completion is not properly displayed by VSCode. This only happens with recent (=~ less than 1 month) release. e.g 1.102.1 in my case. This is a new behaviour that seems to be connected with some recent changes within `reshapeMultiLineInsertion()`[0] [0]: https://github.com/microsoft/vscode/blob/20724f79ba5142f9055a0a38a188fee3f15f79a4/src/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.ts#L681
1 parent a9b732b commit 55e2720

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/features/lightspeed/inlineSuggestions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ const onDoSingleTasksSuggestion: CallbackEntry = async function (
389389
if (leadingWhitespaceCount > 0) {
390390
leadingWhitespace = " ".repeat(leadingWhitespaceCount);
391391
}
392-
let insertText = `${leadingWhitespace}${LIGHTSPEED_SUGGESTION_GHOST_TEXT_COMMENT}${prediction}`;
392+
let insertText = `${leadingWhitespace}${LIGHTSPEED_SUGGESTION_GHOST_TEXT_COMMENT}${prediction.trimEnd()}`;
393393
insertText = adjustInlineSuggestionIndent(
394394
insertText,
395395
inlinePosition.position,

0 commit comments

Comments
 (0)