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

Brackets don't match across strings using different quote marks #986

Open
meteorquake opened this issue Mar 10, 2025 · 5 comments
Open

Brackets don't match across strings using different quote marks #986

meteorquake opened this issue Mar 10, 2025 · 5 comments

Comments

@meteorquake
Copy link

meteorquake commented Mar 10, 2025

A lot of languages use ' or " or ` for string quotations and programmers jump around with which they are using depending on the string concerned.

Currently bracket pairs of various kinds ( ) [ ] { } highlight when the cursor is on one of them when they are in the same type of quoted string but not different quotation types, so -

The brackets highlight here when touched -
'a(bc'+'de)f'

but don't with these -

'a(bc'+"de)f"
'a(bc'+`de)f`

My view is matching should also be done when quote marks differ (like the second 2). It's very helpful that brackets are matched within strings as well as within code.

Cheers! David

@zufuliu
Copy link
Owner

zufuliu commented Mar 16, 2025

This is hard to fix, brace matching only match braces with same style, so operator braces don't match braces inside strings. most lexers color double and single quoted strings as different styles (to simplify tracking of closing quote).

@meteorquake
Copy link
Author

Many thanks! Perhaps an issue that can be raised with the scintilla group?

@zufuliu
Copy link
Owner

zufuliu commented Mar 17, 2025

Maybe not worth it, but you can ask Neil (@nyamatongwe).

@nyamatongwe
Copy link

Doubt it's worth implementing myself. There could be an option for not checking styles.

@meteorquake
Copy link
Author

meteorquake commented Mar 18, 2025

Perhaps there's a simple way to achieve it, perhaps - without knowing the innards - through quote styles having a hidden attribute 'Bracketing Group', because it would be very helpful to have it, the current arrangement being contrary to common sense from a user point of view.
But I'll leave that up to you to think about, I can only encourage its exploration since brackets in strings invariably need matching up, an example is the common situation of code outputting a web document complete with JS.

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

No branches or pull requests

3 participants