I have a small example grammar for explaining my question:
grammar org.xtext.example.hoverCheck.Hov with org.eclipse.xtext.common.Terminals
generate hov "http://www.xtext.org/example/hoverCheck/Hov"
Model:
declaration+=Declaration*
contents+=Content*;
Declaration:
'set' Socket decInt = INT ';'
;
Content:
'add' Socket (Socket | INT | OFFSET) ';'
;
Socket:
('S0'|'S1'|'S2')
;
terminal OFFSET:'OS'('0'|'1');
the language looks like
set S0 0; // set S0 equal to 0
set S1 1; // set S1 equal to 1
set S2 2; // set S2 equal to 2
add S0 S1; // here hover on S0 should show 0 and on S1 should show 1
add S0 S2; // here hover on S0 should show 1 and on S1 should show 2
add S0 OS1; // here hover on S0 should show 1
add S0 OS1; // here hover on S0 should show null because in last command add function was not computed because we dont know value of OS1
I know how to implement hover using MyDslEObjectHoverProvider.
but the problem is whenever i implement hover e:g on S0, it will show the same hover on S0 for the whole code. Is there a way to implement different hover on different lines of the code but on the same datatype rule of the grammar?
Thanks
[Updated on: Thu, 19 November 2015 14:34]
Report message to a moderator