Add asserts to narrow down position issue

This commit is contained in:
Ben Lichtman 2019-12-17 17:04:54 -08:00
parent f90cde4706
commit 925582d034

View File

@ -622,7 +622,10 @@ namespace ts.server {
}
positionToLineOffset(position: number): protocol.Location {
return this.textStorage.positionToLineOffset(position);
const location = this.textStorage.positionToLineOffset(position);
Debug.assert(typeof location.line === "number" && location.line > 0, `Expected line ${location.line} to be greater than 0.`);
Debug.assert(typeof location.offset === "number" && location.offset > 0, `Expected offset ${location.offset} to be greater than 0.`);
return location;
}
public isJavaScript() {