0

I am working on Xtext project. I need feature for my variable declaration. Assume I am using my DSL like one below

LifeEra:Teenage
Age:(while cursor is here)

I wonder if I can get pop-up down here and suggesting 16 since LifeEra entered Teenage. Is there anyway I may achieve that.

Hope my question is clear.

Thank you.

Semih Korkmaz
  • 1,125
  • 13
  • 26

2 Answers2

0

As I understood, code complete from dynamic values is not possible only using Xtext. But developing an Eclipse plugin for your own DSL may help. I couldn't find any other way.

Semih Korkmaz
  • 1,125
  • 13
  • 26
  • Strange thinking: Xtext itself creates several plugins for each grammar. All you have to do is to modify the *.ui plugin. No need to add another plugin. – A.H. Aug 05 '13 at 06:54
  • It has been pretty while since I worked on this and I no longer have reach to code so I can't really comment, but in Xtext as I remember I couldn't implement any dynamic value suggestion as auto-complete. It was not the case for object suggestion. – Semih Korkmaz Aug 06 '13 at 19:42
0

You can indeed customize content assist for your DSL. See http://www.eclipse.org/Xtext/documentation.html#contentAssist and http://zarnekow.blogspot.de/2011/06/customizing-content-assist-with-xtext.html.

thSoft
  • 21,755
  • 5
  • 88
  • 103
  • It wasn't helping in that case. Because, it was possible for it suggest age value for sure; however, as in the example I didn't just require auto-complete for age, I wanted to it read through the code and then make a suggestion for that specific part. As I remember, I couldn't reach the values before compiling via somethin other than Eclipse itself. However, it has been around 2 years and I don't know if things are changed. – Semih Korkmaz Jan 27 '14 at 21:57