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.

    83745be4-2eb3-47c5-a277-2cf01fe23d3e-image.png

    The brace highlight style is independent of lexer language chosen. You cannot set it differently in each language.

    -----
    92eea109-b285-4109-acb5-6d5f1e2615ed-image.png



  • @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



  • @mathlete2 ,

    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:
    486dd4e7-5f54-467d-b88e-ab611af6cc32-image.png
    (problem - note the added if):
    0ecc7caf-b693-4e33-9858-df335bdc50bb-image.png

    Normal text (good):
    19b5c330-6262-4981-8f09-b0e126f5cb01-image.png



  • @mathlete2

    Brace Highlight Style is for normal brace-matching.
    Bad Brace Colour is for indicating a bad match on the parentheses

    f9e55f47-85b1-4a6a-bb29-e094387decb4-image.png



  • @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

    @PeterJones

    The batch lexer is improved in Scintilla 4.4.6 which looks like it may be updated with the next Notepad++ release.

    Cheers.


Log in to reply