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 {
70
70
const suggestionAddedIndentationLength = getLeadingWhitespace ( edit . text ) . length ;
71
71
72
72
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 ) ;
77
80
78
81
const suggestionWithoutIndentationChange =
79
82
edit . text . startsWith ( replacedIndentation )
You can’t perform that action at this time.
0 commit comments