From 73e8d71d6c6a431e5dd4e8f2312130a6cbcfb862 Mon Sep 17 00:00:00 2001 From: Moir Date: Fri, 18 Apr 2025 18:56:18 +0800 Subject: [PATCH] WIP: vscode-eslint unicode bug --- textDocument/src/main.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/textDocument/src/main.ts b/textDocument/src/main.ts index 8cc624c93..84e141757 100644 --- a/textDocument/src/main.ts +++ b/textDocument/src/main.ts @@ -450,8 +450,9 @@ const enum CharCode { function computeLineOffsets(text: string, isAtLineStart: boolean, textOffset = 0): number[] { const result: number[] = isAtLineStart ? [textOffset] : []; - for (let i = 0; i < text.length; i++) { - const ch = text.charCodeAt(i); + const len = Array.from(text).length + for (let i = 0; i < len; i++) { + const ch = text.codePointAt(i)!; if (isEOL(ch)) { if (ch === CharCode.CarriageReturn && i + 1 < text.length && text.charCodeAt(i + 1) === CharCode.LineFeed) { i++;