Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Java 17 highlighting #2677

Closed
aaaaaa2493 opened this issue Sep 29, 2021 · 1 comment · Fixed by microsoft/monaco-languages#159
Closed

Support Java 17 highlighting #2677

aaaaaa2493 opened this issue Sep 29, 2021 · 1 comment · Fixed by microsoft/monaco-languages#159
Labels
feature-request Request for new features or functionality grammars

Comments

@aaaaaa2493
Copy link
Contributor

aaaaaa2493 commented Sep 29, 2021

monaco-editor version: 0.28.0
Browser: Chrome
OS: Windows

Java 17 is out and it's LTS release. Many projects will transit form Java 11 to Java 17. However, it seems that monaco doesn't support Java 12 to 17 syntax features.

  1. Text Blocks (JEP 378)

The entire string should be colored in the same color (brown in Visual Studio theme).

Examples:

String iliadQuote = """
                "But raging still, amidst his navy sat
                The stern Achilles, stedfast in his hate;
                Nor mix’d in combat, nor in council join’d;
                But wasting cares lay heavy on his mind:
                In his black thoughts revenge and slaughter roll,
                And scenes of blood rise dreadful in his soul."
                """;

String query = """
                SELECT "EMP_ID", "LAST_NAME" FROM "EMPLOYEE_TB"
                WHERE "CITY" = 'INDIANAPOLIS'
                ORDER BY "EMP_ID", "LAST_NAME";
                """;

String html = """
            <html>
                <body>
                    <p>Hello, world</p>
                </body>
            </html>
              """;

String example = """
                 You can use "single" or ""double"" quotes any time you like. 
                 But you must escape one if you want triple quotes: \""""
                 or \"\""" if you want four. 
                 The line after me will be directly concatenated onto the same line\
                 But this line will preserve a single trailing space at the end\s
                 And this line will keep six trailing spaces     \s 
                 """;
  1. Various keywords for other features.

Other features seem to be fine, except the new keywords isn't highlighted properly.

Examples:
a. yield in switch expressions (JEP 361). Should be the same color as break and return

String group = switch (planet) {
  case EARTH, MARS -> {
    System.out.println("inner planet");
    System.out.println("made up mostly of rock");
    yield "inner";
  }
  case JUPITER, SATURN -> {
    System.out.println("outer planet");
    System.out.println("ball of gas");
    yield "outer";
  }
};

b. record in records (JEP 395). Should be the same color as class

record Point(int x, int y) { }

public void withLocalRecord() {
  record Point(int x, int y) { };
  Point p = new Point(1, 2);
}

c. sealed, permits, non-sealed in sealed classes (JEP 409).
sealed and non-sealed should be the same color as public, abstract etc.
permits should be the same color as extends and implements.

public sealed class Parent
  permits ChildA, ChildB, ChildC { ... }

sealed interface Parent
  permits ChildA, ChildB, ChildC { ... }

sealed class C permits D, E {}

non-sealed class D extends C {}
@rcjsuen
Copy link
Contributor

rcjsuen commented Sep 29, 2021

The Monarch syntax definition file for Java can be found here if you would like to try making changes to it.

@alexdima alexdima added feature-request Request for new features or functionality grammars labels Oct 8, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality grammars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants