eclipse-langium / langium

Next-gen language engineering / DSL framework
https://langium.org/
MIT License
725 stars 65 forks source link

Content assist not working at specific grammar element #1301

Open cdietrich opened 10 months ago

cdietrich commented 10 months ago

Given the grammar

grammar Cabug2

entry Model:
    'package' package=QualifiedName
    (content+=Thing)*;

ActionParameter:
    (optional?='optional')? name=ID ':' type=Type;

Type: name="Text";

CustomAction:
    (query?='query')? 'action' name=ID '(' (inputParameters+=ActionParameter (',' inputParameters+=ActionParameter)*)? ')' ':' outputValues=Type;

ThingContent:
    ValidationBlock | CustomAction;

Thing:
    'thing' name=ID '{'
        (content+=ThingContent)*
    '}';

ValidationBlock: 'validations' '{' (content+=Statement)* '}';

When: 'when' condition=Expression '{' '}';

Statement:  When ;

QualifiedName returns string:
    ID ('.' ID)*;

Expression:
    Primary;

Primary infers Expression:
    {infer Parenthesis} '(' expr=Expression ')' |
    RefExpression |
    ActionCallExpression ;

ActionArgument:
    parameter=[ActionParameter:ID] '=' value=Expression;

ActionCallExpression:
    action=[CustomAction:ID] '(' (args+=ActionArgument (',' args+=ActionArgument)*)? ')';

RefExpression:
    target=[Thing:ID];

ID returns string: RawId | EscapedId;

hidden terminal WS: /\s+/;
terminal RawId: /[_a-zA-Z][\w_-]*/;
terminal EscapedId: /`[^`]*`/;

hidden terminal ML_COMMENT: /\/\*[\s\S]*?\*\//;
hidden terminal SL_COMMENT: /\/\/[^\n\r]*/;

content assist does not work at

package demo

thing Parent {

    validations {
        when myaction ( <|> ) {}
    }

    query action myaction ( p1: Text , p2: Text, optional p3: Text  ) : Text

}

when i comment out

 RefExpression |

it does