Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Content Sensitive Autocomplete
Content Sensitive Autocomplete [message #1764968] Mon, 05 June 2017 08:43 Go to next message
Denis Kutergin is currently offline Denis KuterginFriend
Messages: 1
Registered: June 2017
Junior Member
Example of DSL grammar:
grammar hellodsl.HelloDsl with org.eclipse.xtext.common.Terminals

generate helloDsl "http://www.HelloDsl.hellodsl"



	'Join' name=ID ';';

	'Leave' name=ID ';';

	'Hello' name=ID ';';

Example of DSL script:
Join Alice;
Join Bob;
Join Mike;
Leave Alice;

How to add in autocomplete (Ctrl-SPACE) after "Hello" only names, defined above in "Join" statement and except names, defined in "Leave" statement? For this example must be 2 variants:

Hello <cursor here>
1) Bob
2) Mike
Re: Content Sensitive Autocomplete [message #1764988 is a reply to message #1764968] Mon, 05 June 2017 14:57 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14496
Registered: July 2009
Senior Member
Hi do you know the concept of cross references and scoping? that is perfect for this usecase.
alternatively have a look at the proposal providers complete Greeting_name method. you can use the context parameter to access the model and traverse it

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:Content Assist not displaying icon before keyword
Next Topic:org.xtext.xtend gradle plugin.
Goto Forum:

Current Time: Sun Jun 04 22:07:42 GMT 2023

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

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

Back to the top