How to limit content assist according to scopinghttps://www.eclipse.org/forums/index.php/mv/msg/457539/1015142/#msg_1015142

I have defined MyDSLScopeProvider to suitably restrict the scope of cross-references in my language. Now I correctly obtain an error if I try to cross-reference an element of the right type, but outside of the defined scope.

On the other hand, using the content assist functionality by pressing CTRL+SPACE in my Xtext editor, I still obtain a list of all elements of the type specified in the cross-reference definition in the grammar, that is a list which is still unfiltered by scoping.

Scoping and content assist are independent from each other?

As far as I understand, I have to override in MyDSLProposalProvider the appropriate methods from AbstractMyDSLProposalProvider, but how? Is there an example of that?

Thanks in advance,
Marco]]>Marco Naddeo2013-02-27T14:58:46-00:00Re: How to limit content assist according to scopinghttps://www.eclipse.org/forums/index.php/mv/msg/457539/1015159/#msg_1015159
I inherited from the XbaseProposalProvider and implemented a few completeXYZ() methods where XYZ is one of my ParserRules that I want completion proposals for.

I had found a few mentions about it to let me know it should be achievable but not enough in the way of examples to let me undestand it and get it working without a lot of trial, error and debugging.

Some attempts give nothing while others include eveything on the planet.

Basically for the Xbase option you choose the completeXYZ method you need and write your custom proposal provider to query your custom scope for the prefix, if any, supplied in the context assist parameter. I expect in your case the default proposal provider would be using the default scope provider and not yours. Even though I had specified my classes in the runtime module, there were still code in the super class that was calling other super class methods and so I had to start overriding more methods to get them to work.

I'd be interested in any other responses with worked examples too.]]>Ian McDevitt2013-02-27T15:36:26-00:00Re: How to limit content assist according to scopinghttps://www.eclipse.org/forums/index.php/mv/msg/457539/1015166/#msg_1015166
this topic message where it is said that the proposal function is based, by default, on scoping. Is that true?

If yes, then why I still obtain all possible references, not filtered via scoping? Any suggestions? ]]>Marco Naddeo2013-02-27T15:47:28-00:00Re: How to limit content assist according to scopinghttps://www.eclipse.org/forums/index.php/mv/msg/457539/1015186/#msg_1015186
--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de]]>Christian Dietrich2013-02-27T17:12:56-00:00Re: How to limit content assist according to scopinghttps://www.eclipse.org/forums/index.php/mv/msg/457539/1015189/#msg_1015189
Or does your custom scope have an outer parent scope which is being included by default. Your scope may need to be an isolated list of items with no outer scope.

I think the reason it includes outer scopes by default is to allow you to show what may be possible under other situations (a bit like showing a greyed out button rather than no button at all). So you may see all methods even private ones which you can't call. If you don't like that then you supply filtering of your choice, but I know what you mean - it seems odd to have only 3 items in your scope and get 30 poposed to you from the outer scope.

I'm planning to rework mine to get the proposals and scoping more closely aligned (i.e. get it to work). Scoping first, then proposals.

Thanks for that link to the other example it looks straight forward.

]]>Ian McDevitt2013-02-27T17:27:48-00:00Re: How to limit content assist according to scopinghttps://www.eclipse.org/forums/index.php/mv/msg/457539/1015197/#msg_1015197
(affects you if the cross reference i the first "real" thing (first assignment) in the rule for the object

XXX: "keyword" yyy=[KKK]

then you have 2 possibilities to workaround this
(1) use scope_XXX_yyy(ParentObject ctx, Ereference ref) instead of scope_XXX_yyy(XXX ctx, Ereference ref)
(2) try to use a unassigned action to force xtext to create the object eager
XXX: {XXX}"keyword" yyy=[KKK]]]>Christian Dietrich2013-02-27T17:40:18-00:00Re: How to limit content assist according to scopinghttps://www.eclipse.org/forums/index.php/mv/msg/457539/1015411/#msg_1015411
I solved it, I simply scoped only one of two alternatives in the grammar...

Now I have scoped both of them, and it works.

Another question: if I want to trigger content assist on dot typing, as in Java editor, how can I get this?]]>Marco Naddeo2013-02-28T14:03:03-00:00Re: How to limit content assist according to scopinghttps://www.eclipse.org/forums/index.php/mv/msg/457539/1015413/#msg_1015413
http://christiandietrich.wordpress.com/2011/09/19/xtext-content-assist-
auto-activation/

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de]]>Christian Dietrich2013-02-28T14:06:01-00:00Re: How to limit content assist according to scopinghttps://www.eclipse.org/forums/index.php/mv/msg/457539/1015905/#msg_1015905

How can I remove it from the drop-down menu?

Thanks again ,
Marco]]>Marco Naddeo2013-03-04T08:56:25-00:00Re: How to limit content assist according to scopinghttps://www.eclipse.org/forums/index.php/mv/msg/457539/1053012/#msg_1053012
Quote:

I solved it, I simply scoped only one of two alternatives in the grammar.

I have the same problem, but couldn't understand what your solution is.

Thanks,
Roza]]>Roza Ghamari2013-05-01T22:00:17-00:00Re: How to limit content assist according to scopinghttps://www.eclipse.org/forums/index.php/mv/msg/457539/1053016/#msg_1053016
scope_Child_ref(Parent ctx, EReference r)]]>Christian Dietrich2013-05-02T00:00:08-00:00Re: How to limit content assist according to scopinghttps://www.eclipse.org/forums/index.php/mv/msg/457539/1053066/#msg_1053066
generally speaking, content assist shows all alternatives possible at the current position, taking into account a potential prefix. The proposal may be identical to the prefix. This will the case for your dot-question.