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 pairing #4815

Open
1 task done
assayire opened this issue Apr 6, 2023 · 3 comments
Open
1 task done

Bracket pairing #4815

assayire opened this issue Apr 6, 2023 · 3 comments
Labels
editor Feedback for code editing, formatting, editor iterations, etc enhancement [core label] setting Feedback for preferences, configuration, etc

Comments

@assayire
Copy link

assayire commented Apr 6, 2023

Check for existing issues

  • Completed

Describe the feature

As a Zed lover, I would love to have the feature to pair closing brackets. Example: When I type [, Zed should insert the matching pair ].

Here is a list of matching pairs that Zed should support:

  • [ and ]
  • ( and )
  • { and }
  • ` and ` Absolutely must for developers
  • ' and '
  • " and "
  • < and >

This should be available under a setting that may be turned on or off by the user.

Bonus: The idea may be extended to HTML(-like) elements. Example: typing <div> should be matched with </div>. Just a passing mention here but there are other nuances to this which may be discussed outside this issue.

If applicable, add mockups / screenshots to help present your vision of the feature

No response

@assayire assayire added enhancement [core label] triage Maintainer needs to classify the issue labels Apr 6, 2023
@JosephTLyons JosephTLyons added editor Feedback for code editing, formatting, editor iterations, etc setting Feedback for preferences, configuration, etc and removed triage Maintainer needs to classify the issue labels Apr 7, 2023
@JosephTLyons JosephTLyons transferred this issue from zed-industries/community Jan 24, 2024
@altayevrim
Copy link

Is there a feature to show or highlight the other part of the pair when I select one of the brackets? Or put my cursor next to it?

@SomeoneToIgnore
Copy link
Contributor

Both features are there, language-dependent.

Brackets autoclose (if enabled in settings) is configured via language's config.toml file, e.g. https://github.com/zed-industries/zed/blob/d0eb15703006fea1208173059b29493b5201d4ec/crates/zed/src/languages/rust/config.toml

Brackets highlight is configured via language's tree-sitter queries in brackets.scm file, e.g. https://github.com/zed-industries/zed/blob/d0eb15703006fea1208173059b29493b5201d4ec/crates/zed/src/languages/rust/brackets.scm

@zambetti
Copy link

zambetti commented Feb 29, 2024

Related to this, does anyone know of a way to set the color/styling of the match pair highlight in a theme file?

*** Update ***
I found it: editor.document_highlight.read_background

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor Feedback for code editing, formatting, editor iterations, etc enhancement [core label] setting Feedback for preferences, configuration, etc
Projects
None yet
Development

No branches or pull requests

5 participants