Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Recommended terminal value for auto-completion
Recommended terminal value for auto-completion [message #1820843] Thu, 30 January 2020 09:40 Go to next message
kolchanov Mising name is currently offline kolchanov Mising nameFriend
Messages: 20
Registered: October 2011
Junior Member
Hello,
I have simple model for testing auto-complition string values.
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
Model:
	items+= (Entity  | Dictionary | Rule)*
;
Entity:
	'entity' name=ID
;
Dictionary:
	'RecommendedValues' 'for' entity=[Entity|ID]
	'[' values+= STRING+ ']' 
;
Rule:
	'Selected' 'value' 'for' entity=[Entity|ID] '=' refValue=STRING
;


Is it possible implement auto-completion in UI with list of 'RecommendedValues' but with possibility to insert arbitrary value?
Re: Recommended terminal value for auto-completion [message #1820846 is a reply to message #1820843] Thu, 30 January 2020 10:18 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hi you might have a look at the concept of template proposals.
you can create them
- shipping templates.xml
- condiguratively
- programmatically

https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#templates


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Recommended terminal value for auto-completion [message #1820849 is a reply to message #1820846] Thu, 30 January 2020 11:29 Go to previous messageGo to next message
kolchanov Mising name is currently offline kolchanov Mising nameFriend
Messages: 20
Registered: October 2011
Junior Member
Thank you,
I'll check this one.
BTW, are template proposals compatible with web or LSP?
Re: Recommended terminal value for auto-completion [message #1820850 is a reply to message #1820849] Thu, 30 January 2020 12:01 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
no. and "depends on how you implement it" see https://github.com/itemis/xtext-languageserver-example/blob/41cb80481485a61efbdfc744029260a916c38011/org.xtext.example.mydsl.ide/src/org/xtext/example/mydsl/ide/contentassist/MyDslIdeContentProposalProvider.xtend#L18

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Debugging a DSL with spaces in its path
Next Topic:cross reference between two resources
Goto Forum:
  


Current Time: Sat Apr 20 01:02:24 GMT 2024

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

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

Back to the top