From 0c40c18e98baca899b1b70c8c138a5320ccacda0 Mon Sep 17 00:00:00 2001 From: Mine Starks Date: Mon, 10 Jul 2017 12:49:29 -0700 Subject: [PATCH] Applying edits in Fourslash can cause caret to move off-range --- src/harness/fourslash.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 434a3981461..04fc21e60e0 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1797,6 +1797,10 @@ namespace FourSlash { // this.languageService.getScriptLexicalStructure(fileName); } + if (this.currentCaretPosition < 0) { + this.currentCaretPosition = 0; + } + if (isFormattingEdit) { const newContent = this.getFileContent(fileName);