-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Goto matching bracket not working in yaml #3614
Comments
I've been looking at that issue. I'm using the following YAML document key: ${value} I've added some debug traces, now I run
It will never match because it considers the start character to be the I notice that the To be honest, I think this is not really an issue, because even if you put |
Surely we could implement a hacky workaround like this one: diff --git a/helix-core/src/match_brackets.rs b/helix-core/src/match_brackets.rs
index 0189dedd..a2aae514 100644
--- a/helix-core/src/match_brackets.rs
+++ b/helix-core/src/match_brackets.rs
@@ -51,7 +51,11 @@ fn find_pair(syntax: &Syntax, doc: &Rope, pos: usize, traverse_parents: bool) ->
loop {
let (start_byte, end_byte) = surrounding_bytes(doc, &node)?;
- let (start_char, end_char) = (doc.byte_to_char(start_byte), doc.byte_to_char(end_byte));
+ let (mut start_char, end_char) = (doc.byte_to_char(start_byte), doc.byte_to_char(end_byte));
+
+ if doc.char(start_char) == '$' && end_char > start_char {
+ start_char += 1
+ }
if is_valid_pair(doc, start_char, end_char) {
if end_byte == pos { This should be relatively safe, because the |
I've opened a draft PR in case that we're interested in adding such things. I feel this is somewhat ugly, yet at the same time may provide a better experience in some cases. But this may also introduce odd behavior in other cases or languages. (I was interested in trying to contribute to Helix because it's an amazing editor, so I just looked for some raised issues trying to see if I can help you folks, either closing issues or contributing useful stuff) |
Let's close this in favor of #3357 which is the same problem |
@the-mikedavis I've found some other users bothered with the same behaviour (on plain text files) #1108, then I've found this one #3584 which seems to me like a good long-term solution. |
…tching when nothing is matched This patch introduces bracket matching independent of tree-sitter grammar. For the initial iteration of this feature, only match on the current line. This matching is introduced as a fallback in cases that tree-sitter matcher does not match any bracket. This fallback should provide a better experience to users that are editing documents without tree-sitter grammer, but also provides a better experience in cases like the ones reported in helix-editor#3614 If we find that this feature works well, we could consider extending it for multi-line matching, but I wanted to keep it small for the first iteration and gather thoughts beforehand.
…hing This patch introduces bracket matching independent of tree-sitter grammar. For the initial iteration of this feature, only match on the current line. This matching is introduced as a fallback in cases that tree-sitter matcher does not match any bracket. This fallback should provide a better experience to users that are editing documents without tree-sitter grammer, but also provides a better experience in cases like the ones reported in helix-editor#3614 If we find that this feature works well, we could consider extending it for multi-line matching, but I wanted to keep it small for the first iteration and gather thoughts beforehand.
…hing This patch introduces bracket matching independent of tree-sitter grammar. For the initial iteration of this feature, only match on the current line. This matching is introduced as a fallback in cases where the tree-sitter matcher does not match any bracket. This fallback should provide a better experience to users that are editing documents without tree-sitter grammar, but also provides a better experience in cases like the ones reported in helix-editor#3614 If we find that this feature works well, we could consider extending it for multi-line matching, but I wanted to keep it small for the first iteration and gather thoughts beforehand.
…hing This patch introduces bracket matching independent of tree-sitter grammar. For the initial iteration of this feature, only match on the current line. This matching is introduced as a fallback in cases where the tree-sitter matcher does not match any bracket. This fallback should provide a better experience to users that are editing documents without tree-sitter grammar, but also provides a better experience in cases like the ones reported in helix-editor#3614 If we find that this feature works well, we could consider extending it for multi-line matching, but I wanted to keep it small for the first iteration and gather thoughts beforehand.
…hing This patch introduces bracket matching independent of tree-sitter grammar. For the initial iteration of this feature, only match on the current line. This matching is introduced as a fallback in cases where the tree-sitter matcher does not match any bracket. This fallback should provide a better experience to users that are editing documents without tree-sitter grammar, but also provides a better experience in cases like the ones reported in helix-editor#3614 If we find that this feature works well, we could consider extending it for multi-line matching, but I wanted to keep it small for the first iteration and gather thoughts beforehand.
…hing This patch introduces bracket matching independent of tree-sitter grammar. For the initial iteration of this feature, only match on the current line. This matching is introduced as a fallback in cases where the tree-sitter matcher does not match any bracket. This fallback should provide a better experience to users that are editing documents without tree-sitter grammar, but also provides a better experience in cases like the ones reported in helix-editor#3614 If we find that this feature works well, we could consider extending it for multi-line matching, but I wanted to keep it small for the first iteration and gather thoughts beforehand.
Summary
The Goto matching bracket not working in yaml.
Reproduction Steps
I tried this:
{
or}
and pressmm
.I expected the cursor to move to the matching bracket, but it didn't move.
Helix log
No response
Platform
Linux
Terminal Emulator
alacritty 0.9.0
Helix Version
helix 22.05 (83f177d)
The text was updated successfully, but these errors were encountered: