Complete keyword with lookahead [message #828096] |
Sat, 24 March 2012 03:23  |
Eclipse User |
|
|
|
Hi!
If one of the next grammar elements of a content assist context is a special keyword how can I propose at this context what follows after the keyword (without hacking the grammar with a special datatype)? For example, if the grammar snippet looks like
IndexedType: "[" ind=[Index] "]"
where "[" is keyword, I want to show up at the context offset before "[" not only the keyword "[", but also the whole completion rule, like "[i]" as a proposal. The problem is, that the complete* and complete_* rules are not called at at context of a keyword, which has no feature assigned to it.
The easiest way would be to override completeKeyword and call completeIndexedType_Ind which itself needs a non-null Assignment object, and I don't know where to get it from. Is there a better method to concatenate following proposals?
Best regards,
Alex.
|
|
|
|
|
Re: Complete keyword with lookahead [message #828472 is a reply to message #828096] |
Sat, 24 March 2012 17:40  |
Eclipse User |
|
|
|
Hi Alex,
you can obtain the assignment from the YourDslGrammarAccess.
Instead of completeKeyword I'd try to specialize the complete_IndexType
implementation.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 24.03.12 03:23, schrieb Alex G:
> Hi!
>
> If one of the next grammar elements of a content assist context is a
> special keyword how can I propose at this context what follows after the
> keyword (without hacking the grammar with a special datatype)? For
> example, if the grammar snippet looks like
>
> IndexedType: "[" ind=[Index] "]"
>
> where "[" is keyword, I want to show up at the context offset before "["
> not only the keyword "[", but also the whole completion rule, like "[i]"
> as a proposal. The problem is, that the complete* and complete_* rules
> are not called at at context of a keyword, which has no feature assigned
> to it.
> The easiest way would be to override completeKeyword and call
> completeIndexedType_Ind which itself needs a non-null Assignment object,
> and I don't know where to get it from. Is there a better method to
> concatenate following proposals?
>
> Best regards,
> Alex.
|
|
|
Powered by
FUDForum. Page generated in 0.04334 seconds