In JS/TS, correctly highlight a variable with a default value…

…when destructuring an array.
This commit is contained in:
Andrew Dupont 2024-01-12 13:28:22 -08:00
parent 99722454b8
commit a34b01bfb2
2 changed files with 14 additions and 0 deletions

View File

@ -145,6 +145,13 @@
(array_pattern
(identifier) @variable.other.assignment.destructuring.js))
; A variable array destructuring with a default:
; The "baz" in `let [foo, bar, baz = false] = something`
(variable_declarator
(array_pattern
(assignment_pattern
(identifier) @variable.other.assignment.destructuring.js)))
; A variable declaration in a for…(in|of) loop:
; The "foo" in `for (let foo of bar) {`
(for_in_statement

View File

@ -136,6 +136,13 @@
(array_pattern
(identifier) @variable.other.assignment.destructuring._LANG_))
; A variable array destructuring with a default:
; The "baz" in `let [foo, bar, baz = false] = something`
(variable_declarator
(array_pattern
(assignment_pattern
(identifier) @variable.other.assignment.destructuring.js)))
; A variable declaration in a for…(in|of) loop:
; The "foo" in `for (let foo of bar) {`
(for_in_statement