@Language annotation for JDK 13 text blocks

Edoardo Luppi lp.edoardo at gmail.com
Fri Feb 7 12:34:16 UTC 2020


Mmh I have mixed feelings about this.
Most people I've met, plus me in this case, prefer to use comment-based
injection (// language=LANG_ID) as comments are less noticeable than
Annotations. Also, I don't think introducing this new Annotation in
java.lang (I suppose) is appropriate and maybe adding complexity to the
spec isn't worth it.

On the other hand, as of now sharing in-code language injection metadata is
difficult because Annotations are tied to the IDE/editor, which means
explicitly imported, e.g. from org.intellij.lang.annotations.Language. In
the worst case scenario you'd have multiple Annotations specified for the
same string literal, one per IDE/editor, or a mixture of Annotations and
Standardizing how injection is to be described could be a good thing! And
not only for text blocks.

Just my two cents.


On Fri, Feb 7, 2020 at 12:59 PM Geertjan Wielenga <geertjan at apache.org>

> Hi all,
> It would be of great support for IDEs, editors, and tools of various kinds
> if a @Language annotation would be part of the support for text blocks, so
> that tooling would be able to determine which editor should be injected
> within the text block.
> For example, imagine this annotation on top of a text block:
> @Language="text/html"
> That would then be used by IDEs, editors, tools, etc, to determine that the
> text within the block is HTML and that therefore, for the tools that
> support this (e.g., NetBeans, IntelliJ IDEA), an HTML editor would then be
> injected within the text block, which would make HTML-oriented syntax
> coloring, code completion, etc, available within the text block.
> If this meets with enthusiasm, what would the next steps be? An addition to
> the text block spec or a new spec or something different?
> Thanks,
> Geertjan

More information about the ide-support-dev mailing list