no content assist proposal for XExpression [message #1451287] |
Thu, 23 October 2014 12:01  |
Eclipse User |
|
|
|
Hi
in one of our Xbase based DSL we have this rule
Specification:
parameterType=JvmTypeReference
'->'
expression = XExpression
;
which the inferrer transforms into a method
specification.toMethod(methodName, returnType) [
parameters += specification.toParameter(
"it", specification.parameterType
)
body = specification.expression
]
and everything works, e.g.,
EClass -> name
the problems are in the content assist, since
EClass -> { <get proposals here, including "name"
but
EClass -> <no proposals but keywords
Since the XExpression is still null (while in the first case you have an
XBlockExpression), the Xbase proposal provider cannot resolve any type
(from what I understand with debugging). It used to work instead in
older versions of Xtext (at least in 2.4, where the Xbase's typesystem
hadn't changed yet).
Something similar happens in the "template" language from the 7 language
examples, e.g., with this input
<!--«
param title = "No Title"
param author = "No Author"
param description = "No Description"
param other = { < here you get proposals for title, author, etc.
but
<!--«
param title = "No Title"
param author = "No Author"
param description = "No Description"
param other = < no proposals but keywords
any suggestion on how to fix this? Or can it be considered a bug?
thanks in advance
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
|
|
|
|
|
|
Re: no content assist proposal for XExpression [message #1731560 is a reply to message #1451410] |
Fri, 06 May 2016 15:10  |
Eclipse User |
|
|
|
Glad I found this.
I have the same problem.
Is there any new advice for handling this?
I have "faked it" for some entries in my grammar, by adding bits to grammar rules which "force" the parser down a certain path:
e.g.
Specification:
parameterType=JvmTypeReference
expression = SpecificationExpression
;
// uses XBlockExpression for context and content assist
SpecificationExpression returns xbase::XBlockExpression:
{xbase::XBlockExpression}
// Move the literal constant here to "force" into the rule
'->'
// only supports a single expression
'expressions+=XExpression
;
However, I have cases where I can't use this trick since there is no applicable literal, such as:
PropertyDefinition:
'property' name=ID type=JvmTypeReference
;
// Rule which should get content assist, but doesn't
PropretyReference:
property=[PropertyDefinition] expression=PropertyReferenceExpression
;
// Attempt to use the trick from above without a literal
PropertyReferenceExpression returns xbase::XBlockExpression:
{xbase::XBlockExpression}
expressions+=XExpression
;
Unfortunately, without the literal to force the building of the expression, this trick doesn't work.
Any advice for handling this?
Thanks yet again!
|
|
|
Powered by
FUDForum. Page generated in 0.03619 seconds