-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Matching brackets not working in plain text. #1108
Comments
Parsing of matching brackets is done by Tree Sitter, so |
Right, I meant tree sitter, good correction. But I wasn't clear if @archseer was saying it should also work on raw text as well: |
Yeah so @sudormrfbin recently labeled all the keybindings that require a LSP or a tree-sitter grammar |
Interesting, thanks! |
Also wondering about why some brackets match in tree-sitter supported files and others don't: 2021-11-16.at.11.57.37.-.Alacritty.-.CleanShot.mp4 |
I think that's because it's not the first and last item in a named node. table: $ =>
seq(
"[",
choice($.dotted_key, $._key),
"]",
$._line_ending_or_eof,
repeat(choice($.pair, newline)),
), Our implementation. helix/helix-core/src/match_brackets.rs Lines 22 to 28 in ed76cdf
Notice the you showed that worked because it's the first and last item. array: $ =>
seq(
"[",
repeat(newline),
optional(
seq(
$._inline_value,
repeat(newline),
repeat(seq(",", repeat(newline), $._inline_value, repeat(newline))),
optional(seq(",", repeat(newline))),
),
),
"]",
), Not very familiar with this, not sure how to solve. |
We need an implementation sans tree-sitter anyway for working with plaintext files or files without a grammar, so we could fall back to that if tree-sitter based matching returns no results. |
I too have noticed that |
This was adrwssed by #4288 and shortcoming in bracket matching when TS is available discussed in the comments were addressed I'm a seperate PR |
Reproduction steps
Expected: Using
mm
on an eligible character will go to the matching character in the pair.Actual: This only seems to work in files with a language server?
2021-11-15.at.16.40.35.-.Alacritty.-.CleanShot.mp4
Environment
The text was updated successfully, but these errors were encountered: