rizonesoft / Notepad3

Notepad like text editor based on the Scintilla source code. Notepad3 based on code from Notepad2 and MiniPath on code from metapath. Download Notepad3:
https://www.rizonesoft.com/downloads/notepad3/
Other
5.15k stars 336 forks source link

[Feature request] plugin syntax definitions for highlighting #5253

Open teknowledgist opened 4 months ago

teknowledgist commented 4 months ago

Notepad3 is great, but I have to work with some configuration/code files written in an esoteric format that no editor recognizes. It would be fantastic if I could create a "syntax rules" document to import into Notepad3 that would then allow for customized syntax highlighting like the existing built-in languages. Other, less-lightweight, not-integrated editors offer this, but having this feature in Notepad3 would really elevate its usefulness.

Since the currently recognized languages have to be defined somewhere in the code, reading similar code for on-demand, custom languages should be relatively straightforward. Of course the syntax of the definition code would probably need some documentation to be useful, but enterprising users might be able to figure it out from examples for common languages.

Although a lot more work, being able to parse/use the existing sizeable library of custom syntax rules for another product (npp) would open up an entire world of possibilities.

Thanks!

SoraHjort commented 1 month ago

I second this. Though I would request in addition to having a simple rule definitions, atleast the option to define the syntax rules through regex. As much as I loathe RegEx, it may be one of the better ways to define it. Especially if it's the full RegEx suite. And maybe later down the line a live editing mode so you can see the highlight changes as you define the rules.

Both Kate and Notepad++ technically have that kind of support, but they don't support full regex proper, such as lookahead/lookbehind. For Kate one of the reasons why they don't is because they store their rules in xmls, which doesn't allow < to be used in the definitions, so they don't do ahead nor behind. (among other regex shenanigans, including their configuration files confusing to work with). Plus you have to restart Kate every time you want to see if the change you made actually worked. And NP++ can really only do it via a third party plugin that hooks into it's built in version of RegEx, which just doesn't have the full suite, it also gets a bit laggy on larger documents if you aren't near the bottom of it. Though on the plus side, it shows the changes live and even isolates to the specific rule you're working on.