langium
langium copied to clipboard
Missing Proposals inside Datatype/Parser rules with "List"/repeat pattern
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)*;
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);
hmmm