Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Objectteams » Semantic highlighting for OT/J scoped keywords
Semantic highlighting for OT/J scoped keywords [message #1847899] Thu, 11 November 2021 21:28
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1845
Registered: July 2009
Senior Member
From the outset, we have been carefully avoiding conflicts between OT/J-specific keywords and their use as regular identifiers in Java.

In OTJLD, the key concept to this end is Scoped Keywords. Later Java introduced similarly conditional keywords (restricted keywords, and restricted identifiers -- similar indeed in intention, just I still think, the way how 'restricted keywords' are defined in Java is a mess).

One thing was still annoying all those years: the OT/J editor (actually the Java Editor with OTDT tweaks applied :) ) would unconditionally highlight our scoped keywords as keywords, even out of scope, i.e., when they were regular identifiers. For common names like 'result', 'get', 'set' etc. this could cause some itch in the eye. This is of course caused by the fact, that pure "syntax highlighting" cannot cope with scoping / conditional highlighting.

Earlier this year JDT exposed an option to separately configure highlighting for Java's restricted identifiers ('var', 'record' etc.).

That's when I thought: let's jump on the bandwagon! So I implemented semantic highlighting for OT/J scoped keywords (also including the unconditional keyword 'team').

The screenshot shows (most of) the code doing this and also serves as example for the effect :)


The benefit is twofold:

  • out-off scope use of these words is not highlighted
  • we can visually distinguish scoped keywords from standard keywords

To achieve the second, OTDT simply changes the default styling for 'restricted identifiers'. Change it back to the regular keyword style, and all will look alike, whichever way you like.

Previous Topic:Translate Eclipse to Portuguese Brasil , what pack i use ?
Next Topic:Classpath problems when running OTJ test suite
Goto Forum:

Current Time: Sat Feb 04 19:49:40 GMT 2023

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

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

Back to the top