Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Use of proposalprovider for content-assist
Use of proposalprovider for content-assist [message #1772235] Thu, 07 September 2017 04:02 Go to next message
Kaushal Patel is currently offline Kaushal PatelFriend
Messages: 72
Registered: June 2017
Member
Hello Experts,

I am trying to implement content-assist in pathexpression using cross-reference within double quotes.

I read these articles to solve reference problems and pathexpression implementation.

https://christiandietrich.wordpress.com/2015/03/19/xtext-and-strings-as-cross-references/

https://christiandietrich.wordpress.com/2013/05/18/xtext-and-dot-expressions/

I am writing grammar for yang language. While writing my yang file in new eclipse application I am getting error in schemanodeidentifier.


This is what I am trying to implement.
submodule "NAME"{
	container "N"{
		leaf-list "A"{		
			leaf "M"{
				list "E";
		}
		}
	}
	augment "/N/A/M/E";
}


I am getting this error:
Couldn't resolve reference to SchemaNode '"/N/A/M/E"'.

I am not getting error when I write like this:
augment /"N"/"A"/"M"/"E";


This is my grammar.

YangFile:
	Module|
	SubModule
;

Module:
	"module" name=STRINGARG
	"{"
	(statements+=Statement)*
	"}"
;


SubModule:
	"submodule" name =STRINGARG
	"{"
		(statements+=Statement)*
	"}"
;
	
Statement:
	  SchemaNode | OtherStatement 
;

SchemaNode :
	DataSchemaNode ;

OtherStatement:
	Augment
;

DataSchemaNode :
	Container |
	List |
	Leaf |
	LeafList
;

Container:
	'container' name=STRINGARG (';'|
		'{'
			(substatements+=DataSchemaNode)
		'}'
	)
;

Leaf :
	'leaf' name=STRINGARG (';'|
		'{'
			(substatements+=DataSchemaNode)
		'}'
	)
;

LeafList:
	'leaf-list' name=STRINGARG (';'|
		'{'
			(substatements+=DataSchemaNode)
		'}'
	)
;

List:
	'list' name=STRINGARG (';'|
		'{'
			(substatements+=DataSchemaNode)
		'}'
	)
;

Augment:
	'augment' path=SchemaNodeIdentifier ';'
;

SchemaNodeIdentifier returns SchemaNodeIdentifier :
	 RootSchemaNodeIdentifier ({SchemaNodeIdentifier.target=current}"/"?(schemanode=[SchemaNode|QNAME]))*
;

RootSchemaNodeIdentifier returns SchemaNodeIdentifier:
	{RootSchemaNodeIdentifier}isAbsolute?="/"?(schemanode=[SchemaNode|QNAME])
;


STRINGARG:
	ID|"default"|INT | STRING ;
	
QNAME:
	(STRINGARG ':')? STRINGARG
;




I haven't use proposal provider or scope provider.
I am confused that what should I use to achieve my output.
Re: Use of proposalprovider for content-assist [message #1772236 is a reply to message #1772235] Thu, 07 September 2017 04:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12239
Registered: July 2009
Senior Member
Use scopeprovider. Content assist itself uses scope provider

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Use of proposalprovider for content-assist [message #1772237 is a reply to message #1772236] Thu, 07 September 2017 04:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12239
Registered: July 2009
Senior Member
And

Could not resolve reference is a scoping error
So you need to fix this anyway

And since the whole thing is the reference you don't have any path


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Use of proposalprovider for content-assist [message #1772239 is a reply to message #1772237] Thu, 07 September 2017 04:52 Go to previous messageGo to next message
Kaushal Patel is currently offline Kaushal PatelFriend
Messages: 72
Registered: June 2017
Member
Thanks Chrisitian,

But I have one more confusion,
Is there any difference between SchemaNodeIdentifier or PathExpression?

As per YANG,
AugmentStatement only uses SchemaNodeIdentifier.
Re: Use of proposalprovider for content-assist [message #1772242 is a reply to message #1772239] Thu, 07 September 2017 05:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12239
Registered: July 2009
Senior Member
in path expression xxx/yyy/zzz consistst of 3 parts = 3 references

same with augment /"N"/"A"/"M"/"E"


SchemaNode "/N/A/M/E" is one part = 1 reference



Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Use of proposalprovider for content-assist [message #1772243 is a reply to message #1772242] Thu, 07 September 2017 05:38 Go to previous messageGo to next message
Kaushal Patel is currently offline Kaushal PatelFriend
Messages: 72
Registered: June 2017
Member
Hi Christian,

I am using your dsl example as a refernce but it shows me error at

EntityRef : Scopes::scopeFor(head.entity.features)


The error is:
The method getEntity() from the type EntityRef refers to the
missing type Object

Re: Use of proposalprovider for content-assist [message #1772244 is a reply to message #1772243] Thu, 07 September 2017 05:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12239
Registered: July 2009
Senior Member
this looks like java is not correctly setup in that project.
have a look at java build path in projects properties


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Use of proposalprovider for content-assist [message #1772247 is a reply to message #1772242] Thu, 07 September 2017 06:13 Go to previous messageGo to next message
Kaushal Patel is currently offline Kaushal PatelFriend
Messages: 72
Registered: June 2017
Member
Hi Christian,

Your example works perfectly.
Thanks.

Can I use content-assist within double quotes.

I am using schemanodeidentifier.
Is it possible that i can import single node using content assist within double-quotes.

for example,

augment "N"

then again control+Space in double quotes for another node,

augment "N/A"

same thing again,

augment "N/A/M"

same again,

augment "N/A/M/E"

Like this.

Appreciate your help.
Re: Use of proposalprovider for content-assist [message #1772251 is a reply to message #1772247] Thu, 07 September 2017 06:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12239
Registered: July 2009
Senior Member
sorry you ghave to digg into content assis ant prefixes for that yourself

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Use of proposalprovider for content-assist [message #1772253 is a reply to message #1772251] Thu, 07 September 2017 07:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12239
Registered: July 2009
Senior Member
maybe you can use a iderivedstatecomputer to turn

"a/b/c/d" into actually the same tree structure as "a"/"b"/"c"/"d" would be. use SyntethiclinkingSupport the feed the scoping with the correct proxys. but that wont help with content assist


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Use of proposalprovider for content-assist [message #1772254 is a reply to message #1772253] Thu, 07 September 2017 07:12 Go to previous messageGo to next message
Kaushal Patel is currently offline Kaushal PatelFriend
Messages: 72
Registered: June 2017
Member
Thanks Christian,

If I don't want to implement content-assist in SchemaNodeIdentifier then I can easily implement it using STRINGARG. I can make it STRING.

The main problem is content assist in within double quotes.
Re: Use of proposalprovider for content-assist [message #1772258 is a reply to message #1772254] Thu, 07 September 2017 07:51 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12239
Registered: July 2009
Senior Member
yes but that is your beer

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xtext and e4 Application
Next Topic:Maven project fails during model validation
Goto Forum:
  


Current Time: Tue Sep 25 02:56:49 GMT 2018

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

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

Back to the top