Code completion - support nested completions
Spoofax 2.3.0
Given the following part of a grammar (this is like the SELECT clause in SQL):
SelectClause.SelectClause = <SELECT <Projection>> Projection.ExpAsVars = <<{ExpAsVar ", "}+>> ExpAsVar.ExpAsVar = <<Exp><VarAssign?>>
And the following program we want to complete:
SELECT
It would be nice if Spoofax could immediately suggests possible completions for the nested Exp, such as the plus operator
SELECT $Exp + $Exp
or the CAST functionSELECT CAST($Exp AS $DateType)
(these parts of the grammar are omitted from the above fragment).Currently, it requires three levels of completions to get there.
- completion 1 suggest ExpAsVars (
SELECT $ExpAsVars
)- completion 2 suggests ExpAsVar (
SELECT $Exp
)- completion 3 suggests the actual completions I’m looking for
This also because not all (web) editors support these templates like Eclipse does, so they can only handle one level of completion (I think).
The Java API
Submitted by Oskar van Rest on 1 November 2017 at 00:47ICompletionService.get(int offset, P result, boolean nested)
seems to have an argument for nested completions, but at least in the cases I tried it was generating no completions or incorrect completions.
Log in to post comments