Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Can not hightlight bracket between closing and opening bracket #350

Open
1 of 5 tasks
bxt opened this issue Apr 18, 2018 · 1 comment
Open
1 of 5 tasks

Can not hightlight bracket between closing and opening bracket #350

bxt opened this issue Apr 18, 2018 · 1 comment

Comments

@bxt
Copy link

bxt commented Apr 18, 2018

Prerequisites

Put an X between the brackets on this line if you have done all of the following:

Description

When you have a text like (())() in the editor and move your cursor the highlights will be (())|() and (()|)() where | indicated the cursor position. There is no way to place your cursor to get this highlight (())() if you don't know which one is the matching opening bracket.

Steps to Reproduce

  1. Enter (())() in a new file
  2. Place your cursor here (()|)() or here (())|()
  3. Observe that the pair of brackets which contains other brackets is never hightlighted

Expected behavior: Brackets are highlighted.

Actual behavior: Brackets are not highlighted.

Reproduces how often: Always.

Versions

You can get this information from copy and pasting the output of atom --version and apm --version from the command line. Also, please include the OS and what version of the OS you're running.

> atom --version
Atom    : 1.25.1
Electron: 1.7.11
Chrome  : 58.0.3029.110
Node    : 7.9.0
> apm --version
apm  1.19.0
npm  3.10.10
node 6.9.5 x64
atom 1.25.1
python 2.7.10
git 2.10.0

macOS

@falcondai
Copy link

falcondai commented Apr 19, 2018

This is due to the trigger rule: bracket-matcher apparently highlights the inner pair on either side of the cursor. This is not a "good" rule in my opinion:

  • According to this rule, ()|() should highlight two pairs. The current implementation only highlights one pair (the latter one) which seems to prioritize the latter pair.
  • This arbitrary stipulation causes the issue with (())().

In summary, I think if we agree on (largely UI/UX goals)

  • Highlighting at most one pair at any time
  • Every matched pair can be highlighted at its opening and closing bracket
    then we are forced to change the current trigger rule.

I propose that we only highlight the pair whose opening/closing bracket is immediately left of the cursor (we can change left to right but we have to commit to only one of them!).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants