Content Assist [message #1024305] |
Tue, 26 March 2013 00:40  |
Eclipse User |
|
|
|
Hi,
I am finding it hard to get the content assist working for the following dsl. To be specific, while defining the type for an attribute (Attribute rule), content assist shows the defined Entities and not the Datatypes (string, decimal,...). For some reason, the methods complete_XXDataType() in the Proposal provider are not getting invoked. If I change the Attribute rule to [0], the complete methods get invoked. Not sure what is going wrong.
I checked the forum but I couldn't find anything related to my problem. I also had a look at couple of dsl's [1], but it didn't help. Any thoughts/pointers ?
NSDeclaration:
// namespace and import
entity=Entity
;
Entity:
'entity' name=ID '{'
attributes+=Attribute*
'}'
;
Attribute:
name=ID ':' type=Type
;
Type:
datatype=DataType | entityRef=EntityReference
;
EntityReference:
entity=[Entity]
;
DataType:
StringDataType | DecimalDataType | BooleanDataType | NumberDataType
;
StringDataType:
'string'
;
DecimalDataType:
'decimal'
;
BooleanDataType:
'boolean'
;
NumberDataType:
'number'
;
------------------------------------------
[0]
Attribute:
name=ID ':' (datatype=DataType | entityRef=EntityReference)
;
-------------------------------------------
[1]
http://www.eclipse.org/Xtext/community.html
Thanks in advance.
[Updated on: Tue, 26 March 2013 00:41] by Moderator
|
|
|
|
Re: Content Assist [message #1027820 is a reply to message #1027294] |
Wed, 27 March 2013 08:59  |
Eclipse User |
|
|
|
Actually I meant Data Type Rules (no assignments or actions) rather than Parser rules.
Also you may think you are in the middle of entering a DataType but the parser/proposer may not know if it's that or an EntityReference so may only be able to call complete_Attribute with a reference of 'type'.
I don't know why [0] makes a difference, I'm just suggesting some pointers above, but I have found that simpler grammars work better than many levels of abstraction.
|
|
|
Powered by
FUDForum. Page generated in 0.07880 seconds