Open mindula opened 2 years ago
@lochana-chathura @rdulmina Can you check this scenario? Will it be possible to improve the parser's recovery logic here?
Sorry, we missed this issue. The thing is above is equivalent to the below when parsing,
configurable public function main() {
}
So we are giving an error and marking the configurable
as an invalid token when a function has a configurable
qualifier.
To give the suggestions for the above cursor position I think we can use the leadingInvalidTokens()
API.
If the node at the cursor position is FunctionDefinitionNode
, can't we use functionDefinitionNode.leadingInvalidTokens()
?
We seem to have a similar usage in ClassDefinitionNodeContext
.
https://github.com/ballerina-platform/ballerina-lang/blob/de51ab86325aabd43053bce9a795974ff45dcc4b/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/completions/providers/context/ClassDefinitionNodeContext.java#L117
We are using leadingInvalidTokens()
API underneath the CommonUtil.getQualifiersOfNode()
.
Description: Consider the following scenario,
The image below shows the syntax tree given for the above scenario,