atom/language-java

Java 14's new record keyword is not highlighted properly

Closed this issue · 5 comments

Prerequisites

Description

Java 14's new record keyword is not highlighted properly

Steps to Reproduce

  1. in a Java class, type record Point(int x, int y){}

Expected behavior:

record should be colored as a Java keyword, similar to class or interface

Actual behavior:

record looks meh
record

Reproduces how often:

100%

cc @Vigilans @akaroml

Can you link java documentation about record keyword? We just need to add it to the grammar, should be fairly easy to do.

Grammar

RecordDeclaration:
  {ClassModifier} record TypeIdentifier [TypeParameters] 
    (RecordComponents) [SuperInterfaces] [RecordBody]

RecordComponents:
  {RecordComponent {, RecordComponent}}

RecordComponent:
  {Annotation} UnannType Identifier

RecordBody:
  { {RecordBodyDeclaration} }

RecordBodyDeclaration:
  ClassBodyDeclaration
  RecordConstructorDeclaration

RecordConstructorDeclaration:
  {Annotation} {ConstructorModifier} [TypeParameters] SimpleTypeName
    [Throws] ConstructorBody

cited from the JEP above

We don't even support JDK 10 and 11 fully yet 😄. Feel free to open a pull request!

PR created. Below is its looking in vscode.

Before

Screen Shot 2020-04-02 at 7 43 57 PM

After

Screen Shot 2020-04-02 at 7 36 47 PM