From 900cdd51ae712f65ba55160ebba13785775e7efa Mon Sep 17 00:00:00 2001 From: Roberto Date: Tue, 18 Aug 2026 20:59:48 +0200 Subject: [PATCH] fix(intellisense): clamp spell-check start line with Math.max `Math.min(0, line-1)` is always <= 0, so any edit on line 0 (and every edit whose start line is 0) builds a Range starting at line -1 and VS Code throws `Illegal argument: line must be non-negative`. The intent is clearly to look one line back without going below 0, i.e. `Math.max`. --- src/intellisense/langMisspellingCheckProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intellisense/langMisspellingCheckProvider.ts b/src/intellisense/langMisspellingCheckProvider.ts index f8a9549e..b5712985 100644 --- a/src/intellisense/langMisspellingCheckProvider.ts +++ b/src/intellisense/langMisspellingCheckProvider.ts @@ -227,7 +227,7 @@ export class MisspellingCheckProvider extends IntellisenseProvider implements vs const uri = e.document.uri; for (const event of e.contentChanges) { // extract changed text - const startLine = Math.min(0, event.range.start.line-1); + const startLine = Math.max(0, event.range.start.line-1); const [endLine, maxLength] = (() => { try { const _line = event.range.end.line;