-
Notifications
You must be signed in to change notification settings - Fork 365
Open
Labels
Description
I often use comments to switch between two commands with the same arguments. In the following code, the syntax highlighting detects that the opening bracket is in %\secondcommand{, instead of \firstcommand{. How to make syntax highlighting ignore brackets in comments, so that it can detect pairs of brackets just like the compiler does ?

Ignoring all comments for syntax highlighting could be an acceptable solution to me, even if it unactivate %TODO detection or other features. How to do that ?
Any help would be appreciated.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
sunderme commentedon May 9, 2025
there is no good way of achieving this.
The bracket matching is done with regex which does not easily allow for comment detection.
You can set up your own definition though, see https://texstudio-org.github.io/background.html#writing-your-own-language-definitions
sunderme commentedon May 9, 2025
You could also move the opening brace to the next line...
mathteacher75 commentedon May 10, 2025
@sunderme This approach is impossible, since i have nested commands, of which several might be commented.