@Language annotation for JDK 13 text blocks

Anthony Vanelverdinghe anthonyv.be at outlook.com
Fri Feb 7 18:36:45 UTC 2020


[moving discussion to amber-dev]

Hi Geertjan

Not sure if there's been public mailing list discussions about it, but 
I'm pretty sure the amber team has already considered the idea of 
attaching this kind of metadata to text blocks. I don't know of any 
related decisions, though.

One issue with annotations in particular, is that text blocks can appear 
in contexts where annotations can't, such as arguments to a method call, 
or annotation element values (JPA's @NamedQuery comes to mind).
Another issue would be: where/how to standardize the set of "languages"? 
The IANA registry with media types doesn't contain things like SQL (let 
alone all its dialects), JSP, JSX, etc. And it's not Java SE's job to 
maintain such a registry either.

Kind regards, Anthony

PS: the Text Blocks JEP [1] specifies amber-dev as the mailing list for 
discussion, so I took the liberty to change the mailing lists. As I 
understand it, ide-support-dev is meant for IDE/tooling support when 
working on the OpenJDK codebase itself

[1] http://openjdk.java.net/jeps/368

On 07/02/2020 12:58, Geertjan Wielenga wrote:
> 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 amber-dev mailing list