mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-20 13:45:34 -05:00
Merge pull request #18625 from Microsoft/fix-getAdjustedStartPosition-on-first-line
Fix get adjusted start position on first line
This commit is contained in:
@@ -152,7 +152,9 @@ namespace ts.textChanges {
|
||||
return position === Position.Start ? start : fullStart;
|
||||
}
|
||||
// get start position of the line following the line that contains fullstart position
|
||||
let adjustedStartPosition = getStartPositionOfLine(getLineOfLocalPosition(sourceFile, fullStartLine) + 1, sourceFile);
|
||||
// (but only if the fullstart isn't the very beginning of the file)
|
||||
const nextLineStart = fullStart > 0 ? 1 : 0;
|
||||
let adjustedStartPosition = getStartPositionOfLine(getLineOfLocalPosition(sourceFile, fullStartLine) + nextLineStart, sourceFile);
|
||||
// skip whitespaces/newlines
|
||||
adjustedStartPosition = skipWhitespacesAndLineBreaks(sourceFile.text, adjustedStartPosition);
|
||||
return getStartPositionOfLine(getLineOfLocalPosition(sourceFile, adjustedStartPosition), sourceFile);
|
||||
|
||||
Reference in New Issue
Block a user