Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » TTCN-3 syntax highlighting in gerrit
TTCN-3 syntax highlighting in gerrit [message #1838001] Fri, 12 February 2021 16:07 Go to next message
Harald Welte is currently offline Harald WelteFriend
Messages: 148
Registered: July 2017
Location: Berlin, Germany
Senior Member

As not only Osmocom but also Eclipse TITAN itself is using gerrit for code review, I think you also might be interested in having TTCN-3 syntax highlighting in gerrit.

gerrit itself uses highlight.js to perform syntax highlighting of many other programming languages, but unfortuantely not for TTCN-3.

I've created a related feature request at https://github.com/highlightjs/highlight.js/issues/2999 and would even be willing to contribute financially to it, in case somebody wants to work on it.

Just thought I'd share this here, in case somebody might already be working on this, to avoid any duplication of work. I woldn't be surprised if this has come up before within Eclipse TITAN developers.

Regards,
Harald
Re: TTCN-3 syntax highlighting in gerrit [message #1838003 is a reply to message #1838001] Fri, 12 February 2021 16:40 Go to previous messageGo to next message
Eclipse UserFriend
Hi Harald,

This is a nice initiative, thank you for raising the idea.

Some time ago, Yann Garcia - as expert from STF 569 - contributed a TTCN lexer to the Rouge ruby package that is used in Gitlab to highlight syntax. You may see the PR on the project, hopefully it may help (I am not allowed to post links, but you may find it by visiting Github, project rouge-ruby/rouge, Pull request 1337)

Also, there are some IDE support packages available at the Tools > Plugins and Extensions page on the official TTCN-3 org website (again, I can't post the direct link) , maybe they could serve as starting point.
Re: TTCN-3 syntax highlighting in gerrit [message #1838006 is a reply to message #1838003] Fri, 12 February 2021 18:21 Go to previous messageGo to next message
Harald Welte is currently offline Harald WelteFriend
Messages: 148
Registered: July 2017
Location: Berlin, Germany
Senior Member

Thanks for your feedback, Michele.

There's also a vim syntax highlighting module for TTCN-3 (which I'm using every day) available from https://github.com/gustafj/vim-ttcn - but unfortuantely neither of that (nor ruby code, ...) is going to help much with adding highlighting support ot that javascript library, I'm afraid.
Re: TTCN-3 syntax highlighting in gerrit [message #1838021 is a reply to message #1838001] Sat, 13 February 2021 12:54 Go to previous messageGo to next message
Gábor Szalai is currently offline Gábor SzalaiFriend
Messages: 138
Registered: December 2015
Senior Member
Our internal gerrit server has syntax highlight for TTCN and ASN files. I\m trying to find some information about it.

Until now i found only an old mail mentioning "codemirror extension logic(mode) for TTCN3, ASN.1 and .cfg files."

Re: TTCN-3 syntax highlighting in gerrit [message #1838022 is a reply to message #1838021] Sat, 13 February 2021 13:34 Go to previous messageGo to next message
Harald Welte is currently offline Harald WelteFriend
Messages: 148
Registered: July 2017
Location: Berlin, Germany
Senior Member

Gábor Szalai wrote on Sat, 13 February 2021 13:54
Our internal gerrit server has syntax highlight for TTCN and ASN files. I\m trying to find some information about it.


Ah, thanks for mentioning this. Based on my research it would mean that highlight.js would have had to be extended - or some completely other mechanism for syntax highlighting introduced into the gerrit codebase.

In eiter case, it would be great to share with the general public, possibly even contributing it upstream.

The latter would mean that https://gerrit.eclipse.org, https://review.gerrithub.io/(both used by TITAN for many repositories) and also our https://gerrit.osmocom.org/ could benefit from this.
Re: TTCN-3 syntax highlighting in gerrit [message #1838036 is a reply to message #1838022] Sun, 14 February 2021 08:44 Go to previous messageGo to next message
Gábor Szalai is currently offline Gábor SzalaiFriend
Messages: 138
Registered: December 2015
Senior Member
It seems our gerrit uses codemirror to display the code in the review plane. There is a plugin for it.
The https://codemirror.net/ supports the TTCN and the cfg syntax of the TITAN out of the box.

Re: TTCN-3 syntax highlighting in gerrit [message #1838038 is a reply to message #1838036] Sun, 14 February 2021 11:49 Go to previous messageGo to next message
Harald Welte is currently offline Harald WelteFriend
Messages: 148
Registered: July 2017
Location: Berlin, Germany
Senior Member

Gábor Szalai wrote on Sun, 14 February 2021 09:44
It seems our gerrit uses codemirror to display the code in the review plane. There is a plugin for it.
The https://codemirror.net/ supports the TTCN and the cfg syntax of the TITAN out of the box.


We're using gerrit 3.2.3 with the corresponding gerrit-codemirror plugin v3.2.3.

However, gerrit.osmocom.org does not provide any syntax highlighting: of ttcn3 code:, as you can see at https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22802

Likweise. https://gerrit.eclipse.org/ (on gerrit 3.2.6) doesn't provide tTCN syntax highlighting either.

So I don't think that the official/public gerrit-codemirror plugin supports ttcn syntax highlighting. I would suspect you use some patches? Would it be possible to publish those, possibly even submit them upstream?

I think https://gerrit.googlesource.com/plugins/codemirror-editor/+/refs/heads/master/gr-editor/codemirror-element.html lists the languages supported by the gerrit plugin., and ttcn[3] is not part of it.
Re: TTCN-3 syntax highlighting in gerrit [message #1838039 is a reply to message #1838038] Sun, 14 February 2021 12:16 Go to previous messageGo to next message
Harald Welte is currently offline Harald WelteFriend
Messages: 148
Registered: July 2017
Location: Berlin, Germany
Senior Member

Without understanding anything about javascript or web frontend development, I've tried my humble attempt to make this work and submitted a patch in https://gerrit-review.googlesource.com/c/plugins/codemirror-editor/+/296842 - unfortuantely I'm not able to test this myself as I cannot get the build instructions for the codemirror-editor gerrit pluging to work.

So I'm not sure if that patch will go anywhere. It would still be good to understnad how the internal gerrit Gabor refers-to has adressed the question of TTCN support.
Re: TTCN-3 syntax highlighting in gerrit [message #1838062 is a reply to message #1838039] Mon, 15 February 2021 07:21 Go to previous messageGo to next message
Gábor Szalai is currently offline Gábor SzalaiFriend
Messages: 138
Registered: December 2015
Senior Member
Honestly, I don't know how the codemirror plugin is integrated into the our gerrit.
Our unit just use it and supported by the central IT unit.

Maybe the mime type settings are missing, but I don't know
Re: TTCN-3 syntax highlighting in gerrit [message #1838067 is a reply to message #1838039] Mon, 15 February 2021 09:57 Go to previous messageGo to next message
Gábor Szalai is currently offline Gábor SzalaiFriend
Messages: 138
Registered: December 2015
Senior Member
Our gerrit kept the old GUI. The syntax highlight works with the old UI but not with the new UI.
Re: TTCN-3 syntax highlighting in gerrit [message #1838071 is a reply to message #1838067] Mon, 15 February 2021 11:26 Go to previous messageGo to next message
Harald Welte is currently offline Harald WelteFriend
Messages: 148
Registered: July 2017
Location: Berlin, Germany
Senior Member

Gábor Szalai wrote on Mon, 15 February 2021 10:57
Our gerrit kept the old GUI. The syntax highlight works with the old UI but not with the new UI.


Thanks for following up. That must be a rather old version (2.x). Since 3.0, the "old" UI is still provided in any supported/stable versions of gerrit. We had to upgrade some time ago due to that in. The latest 2.x branch (2.16) is EOL, see https://www.gerritcodereview.com/releases-readme.html
Re: TTCN-3 syntax highlighting in gerrit [message #1838265 is a reply to message #1838001] Fri, 19 February 2021 20:23 Go to previous messageGo to next message
Matthias Simon is currently offline Matthias SimonFriend
Messages: 6
Registered: February 2021
Junior Member
Is highlight.js the only syntax highlighter available in gerrit or is there maybe an option to use another one, say pygments, for example?
Re: TTCN-3 syntax highlighting in gerrit [message #1838795 is a reply to message #1838265] Fri, 05 March 2021 08:03 Go to previous message
Harald Welte is currently offline Harald WelteFriend
Messages: 148
Registered: July 2017
Location: Berlin, Germany
Senior Member

Matthias Simon wrote on Fri, 19 February 2021 21:23
Is highlight.js the only syntax highlighter available in gerrit or is there maybe an option to use another one, say pygments, for example?


i believe the syntax highlighting happens in the client/browser, that's why highlight.js is used.

For the same reason, I don't think you can easily adapt it to use any other tool in any other language.
Previous Topic:TTCN-3 Language Server
Next Topic:RFC: Configurable warnings / errors for ttcn3_compiler
Goto Forum:
  


Current Time: Mon Dec 30 17:09:18 GMT 2024

Powered by FUDForum. Page generated in 0.06346 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top