You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Oliver Rettig <Ol...@orat.de> on 2023/06/28 18:34:46 UTC

Syntaxhighlighting with textmate for a new language

Hi all, 

we are working on a DSL for "conformal geometric algebra" running in the java 
GraalVM

https://github.com/MobMonRob/DSL4GeometricAlgebra

and I have started to implement tooling in the netbeans ide for it.

For simple starting I want to integrate syntax highleighting by textmate. 

I have followed

https://blogsarchive.apache.org/netbeans/entry/lsp-client-demo-ba-sh

The registration of a textmate grammar file by anntotation is described here:

https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-textmate-lexer/
overview-summary.html

I have implemented a simple netbeans plugin for my .ocga-files:

https://github.com/orat/netbeans-ocga

The files are correctly recognized, the registered icon is shown in the file-
nodes.

The textmate file is found but in the editor nothing happens. No syntax-
highlighing is shown. Also newstart of the ide has no effect.

The textmate-file works fine in visual-studio.

Any ideas what can be wrong?

I have also found the following discussion:

https://www.mail-archive.com/dev@netbeans.apache.org/msg09420.html

with the comment that textmate is maybe broken - if I understand this correct?

Any help appriciated.

Best regards
Oliver




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Syntaxhighlighting with textmate for a new language

Posted by Oliver Rettig <Ol...@orat.de>.
Hi Alexander,

thanks for your answer. The Class OcgaClient is not used - this was an attemp 
to work with LSP. Thats why I have moved this class to the etc folder. So 
mime-type definitions are correct in the used file

https://github.com/orat/netbeans-ocga/blob/master/src/main/java/de/orat/math/
netbeans/ocga/ocgaDataObject.java

It is set to 

text/x-ocga

Any further ideas?

best regards
Oliver

> Hello Oliver,
> 
> I tried to implement basically the same for graphql. I had a quick look at
> your code and I am wondering if the mime type in the MimeRegistration
> annotation in your OcgaClient is correct. It says 'text/sh', I believe this
> is wrong. I cannot look up my old code at the moment, but maybe a hint is
> enough.
> 
> Good luck
> Alex
> 
> Oliver Rettig <Ol...@orat.de> schrieb am Mi., 28. Juni 2023, 20:35:
> > Hi all,
> > 
> > we are working on a DSL for "conformal geometric algebra" running in the
> > java
> > GraalVM
> > 
> > https://github.com/MobMonRob/DSL4GeometricAlgebra
> > 
> > and I have started to implement tooling in the netbeans ide for it.
> > 
> > For simple starting I want to integrate syntax highleighting by textmate.
> > 
> > I have followed
> > 
> > https://blogsarchive.apache.org/netbeans/entry/lsp-client-demo-ba-sh
> > 
> > The registration of a textmate grammar file by anntotation is described
> > here:
> > 
> > https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-textmate-lexer/
> > overview-summary.html
> > <https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-textmate-lexer
> > /overview-summary.html>
> > 
> > I have implemented a simple netbeans plugin for my .ocga-files:
> > 
> > https://github.com/orat/netbeans-ocga
> > 
> > The files are correctly recognized, the registered icon is shown in the
> > file-
> > nodes.
> > 
> > The textmate file is found but in the editor nothing happens. No syntax-
> > highlighing is shown. Also newstart of the ide has no effect.
> > 
> > The textmate-file works fine in visual-studio.
> > 
> > Any ideas what can be wrong?
> > 
> > I have also found the following discussion:
> > 
> > https://www.mail-archive.com/dev@netbeans.apache.org/msg09420.html
> > 
> > with the comment that textmate is maybe broken - if I understand this
> > correct?
> > 
> > Any help appriciated.
> > 
> > Best regards
> > Oliver
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> > For additional commands, e-mail: dev-help@netbeans.apache.org
> > 
> > For further information about the NetBeans mailing lists, visit:
> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Syntaxhighlighting with textmate for a new language

Posted by Alexander Kronenwett <ak...@googlemail.com.INVALID>.
Hello Oliver,

I tried to implement basically the same for graphql. I had a quick look at
your code and I am wondering if the mime type in the MimeRegistration
annotation in your OcgaClient is correct. It says 'text/sh', I believe this
is wrong. I cannot look up my old code at the moment, but maybe a hint is
enough.

Good luck
Alex

Oliver Rettig <Ol...@orat.de> schrieb am Mi., 28. Juni 2023, 20:35:

> Hi all,
>
> we are working on a DSL for "conformal geometric algebra" running in the
> java
> GraalVM
>
> https://github.com/MobMonRob/DSL4GeometricAlgebra
>
> and I have started to implement tooling in the netbeans ide for it.
>
> For simple starting I want to integrate syntax highleighting by textmate.
>
> I have followed
>
> https://blogsarchive.apache.org/netbeans/entry/lsp-client-demo-ba-sh
>
> The registration of a textmate grammar file by anntotation is described
> here:
>
> https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-textmate-lexer/
> overview-summary.html
> <https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-textmate-lexer/overview-summary.html>
>
> I have implemented a simple netbeans plugin for my .ocga-files:
>
> https://github.com/orat/netbeans-ocga
>
> The files are correctly recognized, the registered icon is shown in the
> file-
> nodes.
>
> The textmate file is found but in the editor nothing happens. No syntax-
> highlighing is shown. Also newstart of the ide has no effect.
>
> The textmate-file works fine in visual-studio.
>
> Any ideas what can be wrong?
>
> I have also found the following discussion:
>
> https://www.mail-archive.com/dev@netbeans.apache.org/msg09420.html
>
> with the comment that textmate is maybe broken - if I understand this
> correct?
>
> Any help appriciated.
>
> Best regards
> Oliver
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>

Re: Syntaxhighlighting with textmate for a new language

Posted by Oliver Rettig <Ol...@orat.de>.
Very very thanks Matthias,
you are completely right - now it works like a charm. I thought the gramma file 
was found in the source folder because if I give a wrong file name in the 
annotation

@GrammarRegistration(grammar="ocga.tmLanguage.json", mimeType="text/x-ocga")

I got an error. Do I thought, if the annotation finds the grammar file in the 
source folder all is ok but it is not. 

The gramma file is found only to compile time but not during runtime. During 
runtime the gramma file must be in the resource folder as you write!!!

best regards
Oliver
> Hi Oliver,
> 
> Am Mittwoch, dem 28.06.2023 um 20:34 +0200 schrieb Oliver Rettig:
> > I have implemented a simple netbeans plugin for my .ocga-files:
> > 
> > https://github.com/orat/netbeans-ocga
> > 
> > The files are correctly recognized, the registered icon is shown in the
> > file- nodes.
> > 
> > The textmate file is found but in the editor nothing happens. No syntax-
> > highlighing is shown. Also newstart of the ide has no effect.
> > 
> > The textmate-file works fine in visual-studio.
> > 
> > Any ideas what can be wrong?
> 
> I doubt, that the grammar file is found. The maven project structure is
> incorrect. Maven expects, that in the src/main/java directory only java
> files are found. Everything else is ignored.
> 
> Runtime resources (the grammar file is such a resource), that are to be
> packed into the final jar need to be in the src/main/resources folder.
> This differs from antlr where the grammar file is used at compile time
> and not used at runtime and thus does not need to be packaged.
> 
> TL;DR: Move
> src/main/java/de/orat/math/netbeans/ocga/ocga.tmLanguage.json to
> src/main/resources/de/orat/math/netbeans/ocga/ocga.tmLanguage.json and
> it works.
> 
> Greetings
> 
> Matthias
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
> 
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Syntaxhighlighting with textmate for a new language

Posted by Matthias Bläsing <mb...@doppel-helix.eu.INVALID>.
Hi Oliver,

Am Mittwoch, dem 28.06.2023 um 20:34 +0200 schrieb Oliver Rettig:
> 
> I have implemented a simple netbeans plugin for my .ocga-files:
> 
> https://github.com/orat/netbeans-ocga
> 
> The files are correctly recognized, the registered icon is shown in the file-
> nodes.
> 
> The textmate file is found but in the editor nothing happens. No syntax-
> highlighing is shown. Also newstart of the ide has no effect.
> 
> The textmate-file works fine in visual-studio.
> 
> Any ideas what can be wrong?

I doubt, that the grammar file is found. The maven project structure is
incorrect. Maven expects, that in the src/main/java directory only java
files are found. Everything else is ignored.

Runtime resources (the grammar file is such a resource), that are to be
packed into the final jar need to be in the src/main/resources folder.
This differs from antlr where the grammar file is used at compile time
and not used at runtime and thus does not need to be packaged.

TL;DR: Move
src/main/java/de/orat/math/netbeans/ocga/ocga.tmLanguage.json to
src/main/resources/de/orat/math/netbeans/ocga/ocga.tmLanguage.json and
it works.

Greetings

Matthias

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Syntaxhighlighting with textmate for a new language

Posted by Oliver Rettig <Ol...@orat.de>.
Thanks for the hint to the go-language - in the longer term we have already 
planed to use an ANTLR4 lexer but we thought that for a quick starting 
TextMate is useful. 

We have now learned that the colors shown in the netbeans ide can be different 
to the colors shown in Visual Studio and sometimes the coloring in netbeans 
are not visible.

> Well, I've seen the source has an ANTLR4 Lexer. You'd be better go with
> that.
> 
> I'm afraid that the TextMate library we are using is getting old or not
> 100% feature complete.
> 
> See:
> https://github.com/apache/netbeans/tree/master/ide/languages.go/src/org/netb
> eans/modules/languages/go
> 
> 
> as a sample implementation.
> 
> On 6/28/23 11:34, Oliver Rettig wrote:
> > Hi all,
> > 
> > we are working on a DSL for "conformal geometric algebra" running in the
> > java GraalVM
> > 
> > https://github.com/MobMonRob/DSL4GeometricAlgebra
> > 
> > and I have started to implement tooling in the netbeans ide for it.
> > 
> > For simple starting I want to integrate syntax highleighting by textmate.
> > 
> > I have followed
> > 
> > https://blogsarchive.apache.org/netbeans/entry/lsp-client-demo-ba-sh
> > 
> > The registration of a textmate grammar file by anntotation is described
> > here:
> > 
> > https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-textmate-lexer/
> > overview-summary.html
> > 
> > I have implemented a simple netbeans plugin for my .ocga-files:
> > 
> > https://github.com/orat/netbeans-ocga
> > 
> > The files are correctly recognized, the registered icon is shown in the
> > file- nodes.
> > 
> > The textmate file is found but in the editor nothing happens. No syntax-
> > highlighing is shown. Also newstart of the ide has no effect.
> > 
> > The textmate-file works fine in visual-studio.
> > 
> > Any ideas what can be wrong?
> > 
> > I have also found the following discussion:
> > 
> > https://www.mail-archive.com/dev@netbeans.apache.org/msg09420.html
> > 
> > with the comment that textmate is maybe broken - if I understand this
> > correct?
> > 
> > Any help appriciated.
> > 
> > Best regards
> > Oliver
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> > For additional commands, e-mail: dev-help@netbeans.apache.org
> > 
> > For further information about the NetBeans mailing lists, visit:
> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
> 
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Syntaxhighlighting with textmate for a new language

Posted by Laszlo Kishalmi <la...@gmail.com>.
Well, I've seen the source has an ANTLR4 Lexer. You'd be better go with 
that.

I'm afraid that the TextMate library we are using is getting old or not 
100% feature complete.

See: 
https://github.com/apache/netbeans/tree/master/ide/languages.go/src/org/netbeans/modules/languages/go 


as a sample implementation.

On 6/28/23 11:34, Oliver Rettig wrote:
> Hi all,
>
> we are working on a DSL for "conformal geometric algebra" running in the java
> GraalVM
>
> https://github.com/MobMonRob/DSL4GeometricAlgebra
>
> and I have started to implement tooling in the netbeans ide for it.
>
> For simple starting I want to integrate syntax highleighting by textmate.
>
> I have followed
>
> https://blogsarchive.apache.org/netbeans/entry/lsp-client-demo-ba-sh
>
> The registration of a textmate grammar file by anntotation is described here:
>
> https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-textmate-lexer/
> overview-summary.html
>
> I have implemented a simple netbeans plugin for my .ocga-files:
>
> https://github.com/orat/netbeans-ocga
>
> The files are correctly recognized, the registered icon is shown in the file-
> nodes.
>
> The textmate file is found but in the editor nothing happens. No syntax-
> highlighing is shown. Also newstart of the ide has no effect.
>
> The textmate-file works fine in visual-studio.
>
> Any ideas what can be wrong?
>
> I have also found the following discussion:
>
> https://www.mail-archive.com/dev@netbeans.apache.org/msg09420.html
>
> with the comment that textmate is maybe broken - if I understand this correct?
>
> Any help appriciated.
>
> Best regards
> Oliver
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists