Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Content Sensitive Autocomplete
Content Sensitive Autocomplete [message #1764968] Mon, 05 June 2017 04:43 Go to next message
Eclipse UserFriend
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 10:57 Go to previous message
Eclipse UserFriend
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

Previous Topic:Content Assist not displaying icon before keyword
Next Topic:org.xtext.xtend gradle plugin.
Goto Forum:
  


Current Time: Sun Aug 31 00:51:18 EDT 2025

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

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

Back to the top