Skip to content
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

Bracket matching wrong on Nix #3487

Closed
A-Walrus opened this issue Aug 20, 2022 · 5 comments
Closed

Bracket matching wrong on Nix #3487

A-Walrus opened this issue Aug 20, 2022 · 5 comments
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@A-Walrus
Copy link
Contributor

Summary

With this code snippet:

{
  services.xserver.screenSection = ''
    Option  "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
    Option  "AllowIndirectGLXProtocol" "off"
    Option  "TripleBuffer" "on"
  '';
}

The wrong matching bracket is highlighted, and gone to with mm
image

Possibly related:
#3357
#3432

Reproduction Steps

I tried this:

  1. hx test.nix (file containing above snippet)
  2. cursor on one of the double quotes in lines 3-5

I expected this to happen:
Either:

  • no matching bracket is highlighted (because we are within a string so nix syntax doesn't apply), or
  • The correct matching quote is highlighted

Instead, this happened:
The closing quote for the nix multi-line string is highlighted, despite being a single quote and not a double.

Helix log

~/.cache/helix/helix.log
please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines

Platform

Linux - Nixos

Terminal Emulator

Gnome console

Helix Version

helix 22.05 (27609f5)

@A-Walrus A-Walrus added the C-bug Category: This is a bug label Aug 20, 2022
@the-mikedavis the-mikedavis added the A-helix-term Area: Helix term improvements label Aug 20, 2022
@sohnryang
Copy link
Contributor

sohnryang commented Aug 28, 2022

The above code's ''...'' part is marked as indented_string_expression, which makes it impossible for helix to match correctly. The tree-sitter tree has no information whatsoever regarding contents of the string expression.

@nrdxp
Copy link
Contributor

nrdxp commented Aug 30, 2022

#3594 might help a bit with this, at least in the case where the string contains a language with a tree-sitter parser known to helix.

@A-Walrus
Copy link
Contributor Author

The above code's ''...'' part is marked as indented_string_expression, which makes it impossible for helix to match correctly. The tree-sitter tree has no information whatsoever regarding contents of the string expression.

That's true but doesn't fully explain the behavior. According to that explanation, there is no reason for helix to highlight any matching quotes in this case, especially not a different quote than the one the cursor is on (single vs double)

@nrdxp
Copy link
Contributor

nrdxp commented Aug 31, 2022

Actually, scratch that, Helix doesn't seem to use language injection for text objects yet, only syntax highlighting.

@pascalkuthe
Copy link
Member

pascalkuthe commented Jul 16, 2023

This was fixed by #7242 (its not highlighted anymore now, we don't highlight inside string literals)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

5 participants