TextMate tokenizer enters incorrect scope after typeof a < "u" in JavaScript, affecting subsequent function declarations
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- javascript, typescript
- Lĩnh vực
- tooling
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện ví dụ trong một tệp JavaScript và dùng “Developer: Inspect Editor Tokens and Scopes” để so sánh hai khai báo hàm. Theo dõi các quy tắc ngữ pháp TextMate xử lý typeof a < "u" và khai báo tiếp theo; hoàn tất khi hàm thứ hai nhận được cùng các scopes như hàm thứ nhất và trạng thái tokenizer không còn bị rò rỉ vào mã tiếp theo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
VS Code Version
Version: 1.124.2 (user setup)
Commit: 6928394f91b684055b873eecb8bc281365131f1c
Date: 2026-06-12T00:12:36Z
Electron: 42.2.0
ElectronBuildId: 14159160
Chromium: 148.0.7778.97
Node.js: 24.15.0
V8: 14.8.178.14-electron.0
OS: Windows_NT x64 10.0.26200
Fresh install of VS Code with all default settings. No extensions installed, no custom configuration applied.
Also reproduced on VS Code for the Web (vscode.dev) with no extensions or custom configuration.
Reproducible Example
function bar() {
return "bar";
}
var a = typeof a < "u";
function foo() {
return "foo";
}
Steps to Reproduce
- Install VS Code with all default settings (no extensions, no custom configuration).
- Create a new
.jsfile. - Paste the code above.
- Run:
Developer: Inspect Editor Tokens and Scopes
- Inspect the first
functionkeyword (bardeclaration). - Inspect the second
functionkeyword (foodeclaration).
Actual Result
The first function declaration is tokenized correctly:
storage.type.function.js
meta.function.js
source.js
The second function declaration is tokenized incorrectly:
entity.name.type.js
meta.type.parameters.js
meta.var.expr.js
source.js
Syntax highlighting becomes incorrect for all code following:
var a = typeof a < "u";
Expected Result
The second function declaration should receive the same scopes as the first:
storage.type.function.js
meta.function.js
source.js
No tokenizer state should leak past the end of the variable declaration.
Additional Investigation
Replacing:
var a = typeof a < "u";
with:
var a = typeof a > "u";
Notes
- Reproduced on a fresh VS Code install with all default settings and no extensions.
- Reproduced across all built-in themes; the issue is not theme-specific.
- The JavaScript is syntactically valid.
- Ngôn ngữ chính
- TypeScript
- Star
- 471
- Fork
- 149
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/TypeScript-TmLanguage
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
microsoft/TypeScript-TmLanguage#1071 ·
-
triste Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 5/100
microsoft/TypeScript-TmLanguage#1078 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
microsoft/TypeScript-TmLanguage#1074 · 2 bình luận ·
-
typescript-basics: fix highlighting for triple-slash reference directives with preserve="true" Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 58/100
microsoft/TypeScript-TmLanguage#1066 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
microsoft/TypeScript-TmLanguage#1064 ·
Tất cả issue của microsoft/TypeScript-TmLanguage
Issue tương tự
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Crush Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
ElementsProject/cln-application#167 · 1 bình luận · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Quantco/pnpm-licenses#17 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100