Skip to content

Commit 925582d

Browse files
author
Ben Lichtman
committed
Add asserts to narrow down position issue
1 parent f90cde4 commit 925582d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/server/scriptInfo.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,10 @@ namespace ts.server {
622622
}
623623

624624
positionToLineOffset(position: number): protocol.Location {
625-
return this.textStorage.positionToLineOffset(position);
625+
const location = this.textStorage.positionToLineOffset(position);
626+
Debug.assert(typeof location.line === "number" && location.line > 0, `Expected line ${location.line} to be greater than 0.`);
627+
Debug.assert(typeof location.offset === "number" && location.offset > 0, `Expected offset ${location.offset} to be greater than 0.`);
628+
return location;
626629
}
627630

628631
public isJavaScript() {

0 commit comments

Comments
 (0)