redhat-developer / redhat-developer/vscode-java

Square brackets not recognized in syntax highlighting grammar

Open
#3,528 1 comment 0 reactions 1 assignee View on GitHub

@hopehadfield is already working on this.

Since Mar 13, 2024.

bug highlighting
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

In some cases, square brackets are not recognized as square brackets by the syntax highlighting grammar.

Environment
  • Operating System: N/A
  • JDK version: N/A
  • Visual Studio Code version: 1.87 and 1.88 insiders
  • Java extension version: Latest commit from main
Steps To Reproduce
  1. Create a plain text file with the following content:
public class App {
  public static void main( String[] args ) {
    //                          ↓
    int val1 = new int[]{ 1, 2 }[0];
    //                           ↓
    System.out.println("val1=" + val1);

    int[] arr = new int[]{ 1, 2 };
    //         ↓        ↓
    int val2 = arr[0] + arr[1];
  }
}
  1. Select the Language Mode to Java (java).

  2. You can see that there are several places where the syntax highlighting is incorrect for the down arrows(↓). You can verify this by opening the Command Center and entering the following command: >Developer: Inspect Editor Tokens and Scopes
    (See images below.)

Current Result

1

Expected Result

image

Additional Informations

Originally from @tzengshinfu in https://github.com/microsoft/vscode/issues/206975

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.