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"

Model:
	statements+=Statement*;

Statement:
	Join|Leave|Greeting;

Join:
	'Join' name=ID ';';

Leave:
	'Leave' name=ID ';';

Greeting:
	'Hello' name=ID ';';


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


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: 14665
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



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Content Assist not displaying icon before keyword
Next Topic:org.xtext.xtend gradle plugin.
Goto Forum:
  


Current Time: Thu Apr 25 10:41:39 GMT 2024

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

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

Back to the top