Skip to main content



      Home
Home » Modeling » TMF (Xtext) » remove referece from Content Assist
remove referece from Content Assist [message #1723520] Tue, 16 February 2016 06:17 Go to next message
Eclipse UserFriend
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 06:18] by Moderator

Re: remove referece from Content Assist [message #1723522 is a reply to message #1723520] Tue, 16 February 2016 06:24 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: remove referece from Content Assist [message #1723538 is a reply to message #1723522] Tue, 16 February 2016 08:36 Go to previous messageGo to next message
Eclipse UserFriend
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 09:05 Go to previous messageGo to next message
Eclipse UserFriend
can you share a grammar i can copy and paste
Re: remove referece from Content Assist [message #1723549 is a reply to message #1723544] Tue, 16 February 2016 09:36 Go to previous messageGo to next message
Eclipse UserFriend
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 09:46 Go to previous messageGo to next message
Eclipse UserFriend
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)*

;
Re: remove referece from Content Assist [message #1723552 is a reply to message #1723549] Tue, 16 February 2016 09:46 Go to previous messageGo to next message
Eclipse UserFriend
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 09:47 Go to previous messageGo to next message
Eclipse UserFriend
Dimension:
dimension=ID
;

for that you can adopt content assist
Re: remove referece from Content Assist [message #1723554 is a reply to message #1723553] Tue, 16 February 2016 09:48 Go to previous messageGo to next message
Eclipse UserFriend
so you can go either way.

simply use

Dimension:
dimensions+=ID+
;

and adopt the content assist
Re: remove referece from Content Assist [message #1723644 is a reply to message #1723554] Tue, 16 February 2016 22:48 Go to previous messageGo to next message
Eclipse UserFriend
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] Tue, 16 February 2016 23:36 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: remove referece from Content Assist [message #1723654 is a reply to message #1723648] Wed, 17 February 2016 01:09 Go to previous messageGo to next message
Eclipse UserFriend
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 02:05 Go to previous messageGo to next message
Eclipse UserFriend
yes but this is the non web api Sad
Re: remove referece from Content Assist [message #1723661 is a reply to message #1723654] Wed, 17 February 2016 02:06 Go to previous messageGo to next message
Eclipse UserFriend
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 02:06] by Moderator

Re: remove referece from Content Assist [message #1723664 is a reply to message #1723661] Wed, 17 February 2016 02:27 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: remove referece from Content Assist [message #1723665 is a reply to message #1723664] Wed, 17 February 2016 02:28 Go to previous messageGo to next message
Eclipse UserFriend
p.s. feel free to file a feature request like "i need a filter method"
Re: remove referece from Content Assist [message #1723669 is a reply to message #1723665] Wed, 17 February 2016 02:38 Go to previous messageGo to next message
Eclipse UserFriend
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 02:40 Go to previous messageGo to next message
Eclipse UserFriend
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 02:49 Go to previous messageGo to next message
Eclipse UserFriend
by simply overrding the method and do not call super in this case
Re: remove referece from Content Assist [message #1723686 is a reply to message #1723674] Wed, 17 February 2016 04:07 Go to previous messageGo to next message
Eclipse UserFriend
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 04:07] by Moderator

Re: remove referece from Content Assist [message #1723687 is a reply to message #1723686] Wed, 17 February 2016 04:10 Go to previous messageGo to next message
Eclipse UserFriend
sry cannot help you with that. i dont have time Sad

[Updated on: Wed, 17 February 2016 04:10] by Moderator

Re: remove referece from Content Assist [message #1723688 is a reply to message #1723687] Wed, 17 February 2016 04:11 Go to previous messageGo to next message
Eclipse UserFriend
Ok. No issues. Smile .
Re: remove referece from Content Assist [message #1723691 is a reply to message #1723688] Wed, 17 February 2016 04:21 Go to previous message
Eclipse UserFriend
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: Tue Jul 15 07:44:27 EDT 2025

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

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

Back to the top