Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[wtp-dev] My POC with texmate (for syntax coloration) and Eclipse Text Editor

Hi guys,

I would like to share with you my work about syntax coloration with TextMate. My goal is to support syntax coloration for TypeScript, JSX and Angular2 @Component/template with JSDT Editor inside https://github.com/angelozerr/typescript.java.

It exists http://www.liclipse.com/ which seems supporting TextMate but it's not free. 

So I decided to write my own TextMate support. You can find my code at https://github.com/angelozerr/textmate.java My code is very very very uggly because I have done that quickly :

* I have ported VSCode TextMate written in TypeScript https://github.com/Microsoft/vscode-textmate toJava
 * textmate uses oniguruma regexp. For that I use https://github.com/jruby/joni

The sample editor uses the textmate _javascript_ https://github.com/angelozerr/textmate.java/blob/master/fr.opensagres.language.textmate/src/fr/opensagres/language/textmate/_javascript_.tmLanguage (coming from VSCode)

I have justed colored function and var keyword in the eclipse sample editor but it supports a lot of features like JSX syntax.

You can find textmate token scanner for eclipse https://github.com/angelozerr/textmate.java/blob/master/fr.opensagres.language.textmate.eclipse.sample/src/_editor/TextMateTokenScanner.java which consummes the port of vscode-texmate.

For big files it can take few seconds and freeze the editor. VSCode is slow too but resolves the freeze problem by doing syntax coloration in async way.

Perhaps this coloration with textmate could be done with a semantic higlighter (like SSE) to avoid the freeze.

IMHO, I think Eclipse text editor should provide TextMate support for syntax coloration, because it exists a lot and lot of textmate grammar.

For Angular2 topic, VSCode want to support syntax coloration for @Component/template (html syntax) with TextMate if I have understood. 

If you wish to test the project, don't hesitate to contact me

Many thanks for your feedback and I hope JSDT will provides the capability to support JSX syntax, Angular2 syntax, etc

Regard's Angelo

Back to the top