langium icon indicating copy to clipboard operation
langium copied to clipboard

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

Open cdietrich opened this issue 1 year ago • 2 comments

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 avatar Jul 17 '24 15:07 cdietrich

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 avatar Jul 18 '24 04:07 cdietrich

hmmm grafik

cdietrich avatar Jul 22 '24 11:07 cdietrich