Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Same function, different signature -> ContentAssist
Same function, different signature -> ContentAssist [message #761490] Tue, 06 December 2011 14:45 Go to next message
Federico Sellanes is currently offline Federico SellanesFriend
Messages: 71
Registered: November 2011
Member
Hi !, is me again... Rolling Eyes

In my dsl i have predefined functions like :

guiAddLabel(context,id,text)
guiAddLabel(context,id,text,align)

guiAnotherFunction(arg1,arg2,arg3)
guiAnotherAnotherFunction(arg1)

but in my grammar i only have registered one for each type, for example :

Module:
'module' name=ID 
functions += GuiFunctions*
;

GuiFunctions:
(guiAddLabel=GuiAddLabel
|guiAnotherFunction=GuiAnotherFunction
|guiAnotherAnotherFunction=GuiAnotherAnotherFunction
;

GuiAddLabel:
'guiAddLabel' FunctionImplementation
;

GuiAnotherFunction:
'guiAnotherFunction' FunctionImplementation
;

GuiAnotherAnotherFunction:
'guiAnotherAnotherFunction' FunctionImplementation
;



The point is that when i typed "g" and press ctrl+space the content assist show me :

guiAddLabel
guiAnotherFunction
guiAnotherAnotherFunction

and when i switch from one to other the content assist show me the doc I was wrote and seted before. This work nice.

But, what i am trying to achieve is, get in the content assist something like:

guiAddLabel(context,id,text)
guiAddLabel(context,id,text,align)
guiAnotherFunction(arg1,arg2,arg3)
guiAnotherAnotherFunction(arg1)

And when i press enter above one of this functions, in the editor must appear, for example :

guiAddLabel "without (context,id,text)" or
guiAnotherFunction "without (arg1,arg2,arg3)"

(this is already working in this way, but has not the different signatures of the functions).

Can somebody tell me if i need to update my grammar or if a need to do something in other place, and where?

Honestly i dont know how search for what i want because i dont know how is called what i need

The content assist and the doc is already working, so i not need to know about this.

Thanks, in advanced.

Sorry for my bad english i am using google translate a bit.

[Updated on: Tue, 06 December 2011 14:46]

Report message to a moderator

Re: Same function, different signature -> ContentAssist [message #761638 is a reply to message #761490] Tue, 06 December 2011 19:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
With your grammar same as the last time
hook into completekeyword (to suppress the keyword)
and into complete_GuiAnotherFunction and similar
to do the actual completion

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 06 December 2011 19:34]

Report message to a moderator

Re: Same function, different signature -> ContentAssist [message #762000 is a reply to message #761638] Wed, 07 December 2011 12:09 Go to previous messageGo to next message
Federico Sellanes is currently offline Federico SellanesFriend
Messages: 71
Registered: November 2011
Member
Thanks again, work properly
Re: Same function, different signature -> ContentAssist [message #764785 is a reply to message #762000] Mon, 12 December 2011 21:02 Go to previous message
Federico Sellanes is currently offline Federico SellanesFriend
Messages: 71
Registered: November 2011
Member
Hi again Very Happy,

Supress the keywords in completeKeywords work great when there are only a few functions that i want to delete , but what happens if there is a lot of functions

Suposse now my grammar is :


Module:
'module' name=ID 
(functionsGui += GuiFunctions
functionsView += ViewFunctions)*
;

GuiFunctions:
'guiAddRow' FunctionImplementation 
| 'guiRemoveRow' FunctionImplementation 
// and a lot of anothers functions
;

ViewFunctions:
'viewFunction' FunctionImplementation 
| 'viewFunction2' FunctionImplementation 
// and a lot of anothers functions
;



Exist some way for delete, for example, only the guiFunctions in the contentAssist?

Thanks, in advance.
Previous Topic:Primitive boxing
Next Topic:Strange scoping behaviour
Goto Forum:
  


Current Time: Fri Apr 19 22:14:25 GMT 2024

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

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

Back to the top