Code completion inside function call expression #2079
Replies: 2 comments
|
Hey @AignerGames, can you provide a fully reproducible example? It's hard to tell what is wrong without that. Note that we have a list of issues tagged with |
|
Hello, sorry I can't provide a full example right now. It will take a while. But I asked Copilot and it thinks that the issue happens, because I also have a Grouping Expression, which looks like this: GroupExpressionRule returns GroupingExpression: Copilot assumes that the incomplete function call like "SomeFunction(A," could be mistaken for a grouping in this stage and this could cause the code completion to fail after the comma. Since this is only a "hobby language" I implemented a maybe overkill solution: I added a custom completion handler and check if the base class returns any results, if not I assume that I'm inside a incomplete expression and just return all variables and functions as fallback. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hello, I have the following syntax for a function call expression using langium 4:
interface FunctionCallExpression extends Expression
{
FunctionReference: @FunctionDeclarationStatement
Arguments: Expression[];
}
CallExpressionRule returns FunctionCallExpression:
FunctionReference=[FunctionDeclarationStatement:ID] '(' (Arguments+=ExpressionRule (',' Arguments+=ExpressionRule)*)? ')';
My problem is, that the default code completion doesn't work after the first argument.
SomeFunction( <- Code completion here will show variables
SomeFunction(someVariable, <- Code completion here will NOT show variables, instead it will show the error "Expecting token of type ')' but found
,"But if I finish the expression manually, without code completion, like SomeFunction(someVariable, someOtherVariable); then the error will go away and everything will be parsed correctly.
How can I fix this, so that the variable code completion is also working after the comma?
All reactions