Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » remove referece from Content Assist
remove referece from Content Assist [message #1723520] Tue, 16 February 2016 11:17 Go to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Hi,
This is my grammar

Model:
	greetings=Query;
Query:
	(key=QTypekeyWord)? (aggregation=Aggregation)? (measure=MeasureList) ((by='by'groupBy=GroupBy)? &(condition=Condtition)? );


QTypekeyWord:
	qKeyword='plot'|'chart'
;


Condtition:
	con+='for' dimVal=DimensionValue 'as' dim=Dimension ('and' dimValue=DimensionValue 'as' dimen=Dimension)*
;

MeasureList : names+=Measure ("and" names+=Measure)*;

Measure:ID+;


Dimension:
	dimension=ID+
;

DimensionValue:
	value=ID+
;

GroupBy:
	group+= Dimension ('and' group+=Dimension)* |
	group+= TimeGroup ('and' group+=Dimension)*

;


When I use the content assist , I get the reference name "dimension" after the last word typed.
Here ,
For example

"plot sales by employee for abc" gives me "dimension" after abc as the content assist. I would like to understand whether it is the usual behaviour. Ideally , I would want to Dimension to be same as Measure:ID+;

ie
Dimension:ID+
;

but ,when I run this grammar without a reference for Dimension I get an error. Is this the usual behaviour.

I would like to understand how variable assignement is different from just using ID+ .

[Updated on: Tue, 16 February 2016 11:18]

Report message to a moderator

Re: remove referece from Content Assist [message #1723522 is a reply to message #1723520] Tue, 16 February 2016 11:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
hi,

Dimension:
dimension=ID+
;

makes no sense since it only reads the last ID

Dimension:
dimension=ID
;

creates an object Dimension with an attribute Dimension

if

Dimension: ID+;

then

dim=Dimension will be of type string and not of type Dimension

i have no idea what your problem with Dimension: ID+; is


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: remove referece from Content Assist [message #1723538 is a reply to message #1723522] Tue, 16 February 2016 13:36 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
When I use Dimension: ID+; I get "Cannot find compatible type for the feature 'group'
Re: remove referece from Content Assist [message #1723544 is a reply to message #1723538] Tue, 16 February 2016 14:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
can you share a grammar i can copy and paste

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: remove referece from Content Assist [message #1723549 is a reply to message #1723544] Tue, 16 February 2016 14:36 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
grammar org.xtext.example.mydsl.EinDsl with org.eclipse.xtext.common.Terminals

generate einDsl "http://www.xtext.org/example/mydsl/EinDsl"


Model:
	greetings=Query;
Query:
	(key=QTypekeyWord)? (measure=MeasureList) ((by='by'groupBy=GroupBy)? &(condition=Condtition)? );


QTypekeyWord:
	qKeyword='plot'|'chart'
;


Condtition:
	con+='for' dimVal=DimensionValue 'as' dim=Dimension ('and' dimValue=DimensionValue 'as' dimen=Dimension)*
;

MeasureList : names+=Measure ("and" names+=Measure)*;

Measure:ID+;


Dimension:
	dimension=ID+
;

DimensionValue:
	value=ID+
;

GroupBy:
	group+= Dimension ('and' group+=Dimension)*

;
Re: remove referece from Content Assist [message #1723551 is a reply to message #1723549] Tue, 16 February 2016 14:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
i dont get any problem with that nor with this one

Model:
	greetings=Query;
Query:
	(key=QTypekeyWord)? (measure=MeasureList) ((by='by'groupBy=GroupBy)? &(condition=Condtition)? );


QTypekeyWord:
	qKeyword='plot'|'chart'
;


Condtition:
	con+='for' dimVal=DimensionValue 'as' dim=Dimension ('and' dimValues+=DimensionValue 'as' dimen+=Dimension)*
;

MeasureList : names+=Measure ("and" names+=Measure)*;

Measure:ID+;


Dimension:
	ID+
;

DimensionValue:
	ID+
;

GroupBy:
	group+= Dimension ('and' group+=Dimension)*

;


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: remove referece from Content Assist [message #1723552 is a reply to message #1723549] Tue, 16 February 2016 14:46 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Ideally I wish to have Measure type and Dimension Type such that its easy to add validation and use in Test Class like
var dimension=result.greetings.getGroupBy.getGroup.get(0) as Dimension;

At the same time , I do not intend to show the name of reference "dimention" when I use

Dimension:
dimension=ID
;

Only issue is that I get the value "dimension" in content assist.

For example "plot abc by pqr" is showing me "plot abc by pqr dimension" . I do not wish to have this variable name as content assist.

Is filter a better way to solve this issue.
Re: remove referece from Content Assist [message #1723553 is a reply to message #1723552] Tue, 16 February 2016 14:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
Dimension:
dimension=ID
;

for that you can adopt content assist


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: remove referece from Content Assist [message #1723554 is a reply to message #1723553] Tue, 16 February 2016 14:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
so you can go either way.

simply use

Dimension:
dimensions+=ID+
;

and adopt the content assist


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: remove referece from Content Assist [message #1723644 is a reply to message #1723554] Wed, 17 February 2016 03:48 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Thanks Christian. Could you please direct me to an example for filtering content assist.
Re: remove referece from Content Assist [message #1723648 is a reply to message #1723644] Wed, 17 February 2016 04:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
pranay roy <forums-noreply@xxxxxxxx> wrote:
> Thanks Christian. Could you please direct me to an example for filtering content assist.
>

No I don't have any. Simply have a look at the methods and debug the
proposal provider


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: remove referece from Content Assist [message #1723654 is a reply to message #1723648] Wed, 17 February 2016 06:09 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Ok .I saw this example .but I cant find the method in IdeContentAssistProvider as mentioned in the post.

https://kthoms.wordpress.com/2012/05/22/xtext-content-assist-filtering-keyword-proposals/
Re: remove referece from Content Assist [message #1723660 is a reply to message #1723654] Wed, 17 February 2016 07:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
yes but this is the non web api Sad

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: remove referece from Content Assist [message #1723661 is a reply to message #1723654] Wed, 17 February 2016 07:06 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Also,
my question is also to on the content assist .

For string "plot abc by pqr " (Space after pqr) is showing me "plot abc by pqr dimension" as a proposal.

I can filter the word "dimension" from my proposals but I wish to understand How is this happenning.?

[Updated on: Wed, 17 February 2016 07:06]

Report message to a moderator

Re: remove referece from Content Assist [message #1723664 is a reply to message #1723661] Wed, 17 February 2016 07:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
as i said:

set a breakpoint in

-org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider._createProposals(Assignment, ContentAssistContext, IIdeContentProposalAcceptor) and similar places
- or in your IIdeContentProposalAcceptor impls accept method. and see who calls it with which data


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: remove referece from Content Assist [message #1723665 is a reply to message #1723664] Wed, 17 February 2016 07:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
p.s. feel free to file a feature request like "i need a filter method"

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: remove referece from Content Assist [message #1723669 is a reply to message #1723665] Wed, 17 February 2016 07:38 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
This Context creates the proposal "dimension" . For both the current model and previous models are dimensions . This seems to be correct since Dimension category can have multiword. Am I right.?


currentModel = {DimensionImpl@11120} "org.xtext.example.mydsl.einDsl.impl.DimensionImpl@27f71857 (dimension: [pqr])"
previousModel = {DimensionImpl@11120} "org.xtext.example.mydsl.einDsl.impl.DimensionImpl@27f71857 (dimension: [pqr])"
Re: remove referece from Content Assist [message #1723672 is a reply to message #1723669] Wed, 17 February 2016 07:40 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
I also see that feature is added as proposal. How can I restrict feature names from getting added.

  String _feature = assignment.getFeature();
                String _plus = ("\"" + _feature);
                String _plus_1 = (_plus + "\"");
                it.setProposal(_plus_1);
Re: remove referece from Content Assist [message #1723674 is a reply to message #1723672] Wed, 17 February 2016 07:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
by simply overrding the method and do not call super in this case

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: remove referece from Content Assist [message #1723686 is a reply to message #1723674] Wed, 17 February 2016 09:07 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Could you give an example . I think I might break something because of multiple If checks in the super method .

[Updated on: Wed, 17 February 2016 09:07]

Report message to a moderator

Re: remove referece from Content Assist [message #1723687 is a reply to message #1723686] Wed, 17 February 2016 09:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
sry cannot help you with that. i dont have time Sad

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 17 February 2016 09:10]

Report message to a moderator

Re: remove referece from Content Assist [message #1723688 is a reply to message #1723687] Wed, 17 February 2016 09:11 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Ok. No issues. Smile .
Re: remove referece from Content Assist [message #1723691 is a reply to message #1723688] Wed, 17 February 2016 09:21 Go to previous message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
This solves my issue. I wonder how !Razz

override protected dispatch void createProposals(Assignment assignment, ContentAssistContext context,
    IIdeContentProposalAcceptor acceptor){
        var terminal = assignment.getTerminal()

        if (terminal instanceof RuleCall) {
            return;
        }
    }
Previous Topic:IResourceDescription's URI sync
Next Topic:Can't find Miro's blog on Xtext web editor
Goto Forum:
  


Current Time: Sat Sep 18 02:40:40 GMT 2021

Powered by FUDForum. Page generated in 0.02105 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top