From 925582d03487b2ca3c2454527c9bedca60ccec6c Mon Sep 17 00:00:00 2001 From: Ben Lichtman Date: Tue, 17 Dec 2019 17:04:54 -0800 Subject: [PATCH] Add asserts to narrow down position issue --- src/server/scriptInfo.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 15ab756887c..4f471d6ab37 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -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() {