martinrotter / textosaurus

Cross-platform text editor based on Qt and Scintilla.
GNU General Public License v3.0
284 stars 44 forks source link

how to customize the new programming language highlighters? #72

Closed mscheng closed 4 years ago

mscheng commented 5 years ago

I want to add a new lexers for me, so how to customize the new programming language highlighters?

martinrotter commented 5 years ago

Hello @mscheng, Textosaurus only supports built-in lexers at this point, but I would imagine adding user-defined lexers could make some sense, but it isn't a priority for me surely.

Is this feature present in any other text editor SW you use? Write some, so that I can inspire...

DriNeo commented 5 years ago

For Gedit highlighting definitions for a given language are in an xml file. And this file may be used by every GTK based editor. I don't know how Qt based editor defines the highlightings but please don't use scripting language like Textadept does. Textadept just gives the full api in Lua and you'll have to code everything, even for simple things. I suggest to use files like json, yaml or even xml, to help contributors to add language highlightings.

boussou commented 5 years ago

Hi, what prevents me to use it is: it doesn't have suppor for PHP. Too bad, it has a lot a nice feature compared to scite.

martinrotter commented 4 years ago

@DriNeo Just checked GTKsourceView XML syntax and it seems rather difficult at this point to add this kind of support into Textosaurus. I would maybe imagine just simple set of keywords to highlight with different customiseable colors.

What languages are you missing?

@boussou What do you exactly mean with "PHP support"?

boussou commented 4 years ago

@martinrotter It is about PHP syntax highlight. Using Scite it recognize it based on file extension, it also able to highlight from a simple paste on a blank document

martinrotter commented 4 years ago

@martinrotter It is about PHP syntax highlight. Using Scite it recognize it based on file extension, it also able to highlight from a simple paste on a blank document

Right now, I am commiting new PHP highlighter for you, it should recognize all PHP keywords, numbers etc.

Use "PHP" syntax for this. "HTML" syntax is from now on meant only for HTML-only documents.

image

martinrotter commented 4 years ago

Closing this guys. If you miss any Scintilla-supported highlighters, create separate tickets and I will add those. PHP highlighter is now added, pls test it.