Community
Participate
Working Groups
Repro: -Create emptry project with following grammar: ================================== grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "http://www.xtext.org/example/mydsl/MyDsl" Script: (statements+=Statement)*; Statement: (VariableDeclaration|VariableReference) ';' ; VariableReference: var = [VariableDeclaration] ; VariableDeclaration: "var" name=ID; ==================================== - Generate, run Target platform, create project. - Create "file1.mydsl" with content ========== var v1; ========== - Create "file2.mydsl" (empty). - Press Ctrl-Space. The only proposal is "var". - Type "v1;" -> File is valid - Press Ctrl-Space again. Now proposal "v1" appears (beside "var"). Reason: Problem is that AbstractMyDslProposalProvider.completeVariableReference_Var() doesn't create proposals as long as the file is logically empty. At this point in time the root object "Script" has not yet been created. Therefore the parameter "model" is null. Therefore ReferenceProposalCreator.lookupCrossReference will not ask the (global) scope provider for possible references. I would suggest to find a way that the root object of a grammar is initialized earlier and ideally is never null.
This behavior is expected if your root rule refuses to instantiate an element because everything is optional. Please try Script: {Script} (statements+=Statement)*; to force the parser to instantiate a model. Please reopen if the problem persists.
Closing all bugs that were set to RESOLVED before Neon.0