atom / language-java

Java package for Atom
Other
62 stars 59 forks source link

Java 14's new record keyword is not highlighted properly #223

Closed fbricon closed 4 years ago

fbricon commented 4 years ago

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

sadikovi commented 4 years ago

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

fbricon commented 4 years ago

There: https://openjdk.java.net/jeps/359

Eskibear commented 4 years ago

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

sadikovi commented 4 years ago

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

Eskibear commented 4 years ago

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