atom/language-java

`try`-with-resources syntax highlighting broken at block start

Closed this issue · 1 comments

Prerequisites

Description

Here's a couple screenshots, which should explain everything. The first is within a Markdown document, and the second is the same snippet, in its own file.

screen shot 2018-09-12 at 10 39 48 pm

screen shot 2018-09-12 at 10 41 25 pm

Steps to Reproduce

  1. Type the above into a source file.

Here's the source code, if you just want to copy/paste:

// Java 6
static String readFirstLineFromFile(String path) throws IOException {
    BufferedReader br = new BufferedReader(new FileReader(path));
    try {
        return br.readLine();
    } finally {
        if (br != null) br.close();
    }
}

// Java 7
static String readFirstLineFromFile(String path) throws IOException {
    try (BufferedReader br = new BufferedReader(new FileReader(path))) {
        return br.readLine();
    }
}

If you're curious, it's mostly stolen from this tutorial example targeting Java 8, just with the methods renamed.

Expected behavior: It to highlight correctly.

Actual behavior: Lots of incorrect red highlighting.

Reproduces how often: 100% of the time.

Versions

You can get this information from copy and pasting the output of atom --version and apm --version from the command line. Also, please include the OS and what version of the OS you're running.

Atom version: 1.30.0
apm version: 1.19.0
OS: macOS High Sierra (64-bit)

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

This was fixed in #146 but hasn't made its way into an Atom release yet.