customize delimiter highlighting
-
I really like the feature that highlights start/end delimiters when the cursor is set adjacent to one of them. However, many of the pairs I am dealing with are several lines away; the lines are automatically broken down with a
\
, so the background change to white doesn’t always help. Also, the colour change in the characters themselves isn’t that dramatic (from a maroonish to red); I could change the standard colour of delimiters to be more distinct from the red that NP++ uses for pair highlighting, but this is a colour-coding scheme based on a specific language, so I’d rather avoid this if possible. A custom background colour would be more useful either way; is there a way to customize this background colour yet? -
@mathlete2 said in customize delimiter highlighting:
is there a way to customize this background colour yet?
“Yet”? There has been, for a very long time – I checked my old versions, and it was available and working in v7.0 from 2016 and even in v6.0 from 2012.
The brace highlight style is independent of lexer language chosen. You cannot set it differently in each language.
-----
-
@PeterJones perfect! that’s exactly what I was looking for - I was expecting to see this in “Preferences” since similar/related options were found there
-
For future reference: All text styling¹ – color and font settings – are found in the Style Configurator.
reference: https://npp-user-manual.org/docs/preferences/
—
edit ¹. Except for User Defined Language styling, which is done in the UDL dialog. -
@PeterJones yes, I have been playing around with UDLs as well, but didn’t see this particular customization. I tried searching the documentation you referenced as well, but I couldn’t find it because “brace” was used instead of “delimiter”, so thanks for pointing it out.
incidentally, for those using this on VMs with access to a network drive as well, these customizations are stored in
C:\Users\%USERNAME%\AppData\Roaming\Notepad++\stylers.xml
-
@PeterJones ok, new problem: it looks like there’s a category for a “bad brace”, which isn’t identified consistently (see below). Do you know of a way to override this setting for all scenarios, or should I post a new question?
Batch:
good:
(problem - note the addedif
):
Normal text (good):
-
Brace Highlight Style is for normal brace-matching.
Bad Brace Colour is for indicating a bad match on the parentheses -
@mathlete2 said in customize delimiter highlighting:
which isn’t identified consistently (see below). Do you know of a way to override this setting for all scenarios,
If by “consistently”, you mean that the Batch syntax highlighter has a different set of rules for when a brace “matches” or not, then that is by design: different languages have different lexer algorithms, because different languages can have different rules on nesting of braces.
If you disagree with the individual’s lexer’s decision on what constitutes a “bad brace”, I’m afraid there isn’t much recourse – Notepad++ inherits the lexers from Scintilla, and Scintilla has shown a reluctance to make changes in the builtin lexers, presumably because they’ve been vetted as-is for years now, and all the universally-agreed-upon bugs have been fixed. (And/or because Scintilla appears to be moving away from the builtin lexers, and is instead encouraging people who use their IP to develop their own lexers. Probably lexer maintenance was getting in the way of developing their core product, so they are trying to foist it onto someone else. ;-) ) So likely, not much will happen, even if you report that problem to Scintilla.
You could set the brace highlighting background and bad brace background to the same value… but the matching-brace won’t find the other end of what you consider to be a “good” matching brace, because the lexer disagrees with you.
Unfortunately, there’s nothing to be done in settings to disregard the lexer’s definition of a matched brace. Sorry.
-
@mathlete2 said in customize delimiter highlighting:
Batch
The batch lexer is improved in Scintilla 4.4.6 which looks like it may be updated with the next Notepad++ release.
Cheers.