Skip to content

Commit aa24684

Browse files
authored
fix: inline completion not displaying(microsoft#184108)
1 parent ccf1d56 commit aa24684

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/vs/editor/contrib/inlineCompletions/browser/singleTextEdit.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,13 @@ export class SingleTextEdit {
7070
const suggestionAddedIndentationLength = getLeadingWhitespace(edit.text).length;
7171

7272
const replacedIndentation = sourceLine.substring(edit.range.startColumn - 1, sourceIndentationLength);
73-
const rangeThatDoesNotReplaceIndentation = Range.fromPositions(
74-
edit.range.getStartPosition().delta(0, replacedIndentation.length),
75-
edit.range.getEndPosition()
76-
);
73+
74+
const [startPosition, endPosition] = [edit.range.getStartPosition(), edit.range.getEndPosition()];
75+
const newStartPosition =
76+
startPosition.column + replacedIndentation.length <= endPosition.column
77+
? startPosition.delta(0, replacedIndentation.length)
78+
: endPosition;
79+
const rangeThatDoesNotReplaceIndentation = Range.fromPositions(newStartPosition, endPosition);
7780

7881
const suggestionWithoutIndentationChange =
7982
edit.text.startsWith(replacedIndentation)

0 commit comments

Comments
 (0)