Apex Parser not great at recovering

Issue #1779 resolved
Xander Victory created an issue

The Apex parser seems to be in need of some better recovery rules, especially in relation to inner classes.

Frequently while typing code in a method above an inner class, the parser fails to recover and considers the inner to not exist, hampering efforts to use autocomplete involving said inner.

public class SomeClass
{
    public Integer foo(){
        SomeInner baz = 
    }

    public class SomeInner {

    }
}

Comments (4)

  1. Scott Wells repo owner

    Hmmmm...I'll take a look. The parser is definitely fat with recovery rules just for purposes of being able to handle partially-formed/malformed code properly given IDE use cases. Perhaps this is just a place where it's not doing so sufficiently.

  2. Scott Wells repo owner

    Easily reproduced. The issue isn't with inner classes. It's specifically with incomplete local variable declarations. Trying to see how best to handle this now.

  3. Scott Wells repo owner

    Fix committed for inclusion in the next build. It ended up being a very simple fix once I found the right production.

  4. Log in to comment