eclipse-langium / langium

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

Missing Proposals inside Datatype/Parser rules with "List"/repeat pattern #1583

Open cdietrich opened 3 months ago

cdietrich commented 3 months ago

Given the datatype rule

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

with

ID returns string: RawId | EscapedId;
terminal RawId: /[_a-zA-Z][\w_-]*/;
terminal EscapedId: /`[^`]*`/;

and a bit more lenient proposal provider

export class HelloWorldCompletionProvider extends DefaultCompletionProvider {

    protected override filterKeyword(_context: CompletionContext, _keyword: GrammarAST.Keyword): boolean {
        return true
      }

      protected override continueCompletion(items: CompletionItem[]): boolean {
          return true
      }

      protected override performNextTokenCompletion(document: LangiumDocument, text: string, _offset: number, _end: number): boolean {
          return true
      }

}

given model

a| the . will be proposed,

at

a.b| the . will NOT be proposed,

same for normal parser rule

Thing:
    "thing" names+=ID ("." names+=ID)*;
cdietrich commented 3 months ago

possible workaround

Thing:
    "thing" names+=ID ThingyRestList*;

fragment ThingyRestList:
    ("." names+=ID);
ID returns string: RawId | EscapedId;
QualifiedName returns string: ID QNF*;
fragment QNF returns string: ('.' ID);
cdietrich commented 3 months ago

hmmm grafik