You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Parse the condition of a for loop into a dedicated node #315
When parsing a for, the condition is parsed such that the for keyword and the parentheses are included directly into the parent for_in_statement node. For example, this input:
for (x of y) {
foo();
}
Produces a tree like so (the output here is from NeoVim's :InspectTree command):
For consumers of the tree that wish to implement bracket matching, this requires special handling as there's nothing in the tree that clearly indicates the ( and ) are paired together (see also yorickpeterse/nvim-tree-pairs#1). Various languages that I've tried (e.g. Rust, Lua, Python, etc) include the ( and ) (or any other bracket for that matter) into a dedicated node, making it easy to find out the start/end of the rang.
Would it be possible to also apply this to this JavaScript parser, thereby making bracket matching easier?
Activity
yorickpeterse commentedon Apr 19, 2024
Essentially what I'm looking for is a tree like this: