Skip to content

[diffs/editor] Add match brackets#940

Open
ije wants to merge 3 commits into
beta-1.3from
editor/match-brackets
Open

[diffs/editor] Add match brackets#940
ije wants to merge 3 commits into
beta-1.3from
editor/match-brackets

Conversation

@ije

@ije ije commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Add match brackets, can be disabled by adding matchBrackets in the editor options.

Screen.Recording.2026-07-03.at.23.09.32.mov

@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierre-docs-diffs Ready Ready Preview Jul 7, 2026 8:31am
pierre-docs-diffshub Ready Ready Preview Jul 7, 2026 8:31am
pierre-docs-trees Ready Ready Preview Jul 7, 2026 8:31am
pierrejs-diff-demo Ready Ready Preview Jul 7, 2026 8:31am

Request Review

@ije ije requested review from amadeus and necolas July 3, 2026 15:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e393e7626f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/diffs/src/editor/tokenzier.ts Outdated
Comment on lines +232 to +233
--diffs-editor-bracket-match-bg: ${bracketMatchBackground ?? 'unset'};
--diffs-editor-bracket-match-border: ${bracketMatchBorder ?? 'unset'};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve fallback bracket-match styling

With themes that don't define editorBracketMatch.background or editorBracketMatch.border (the bundled Pierre themes don't), these assignments still define the CSS variables as unset, so the fallback colors in editor.css are never used; background-color becomes transparent and the border-bottom shorthand is invalid after substitution. As a result bracket matches can render with no visible highlight by default, so leave these variables undefined or assign the fallback values when the theme key is absent.

Useful? React with 👍 / 👎.

@ije ije Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use initial instead of unset in dfadcf9

@ije

ije commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dfadcf9dfc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +28 to +29
text ??= textDocument.getText();
ignoredOffsets ??= getBracketIgnoredOffsets(text);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid rescanning the whole document for each bracket move

With bracket matching enabled by default, every selection update where the caret is adjacent to a bracket calls getText() and rebuilds ignoredOffsets for the entire TextDocument before searching. In large editable diffs/files, simply arrowing over a bracket allocates and scans O(file size) on the UI path even when the match is nearby, which can freeze the editor; cache this per document version or limit the scan/token data to the needed range.

Useful? React with 👍 / 👎.

chatgpt-codex-connector[bot]

This comment was marked as outdated.

@ije ije force-pushed the editor/match-brackets branch from 5fc7865 to dfadcf9 Compare July 7, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant