File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
src/vs/editor/contrib/inlineCompletions/browser Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments