Re: Cedet Semantic does not show overloaded functions in either: semantic-ia-complete-symbol-menu OR autocomplete-text after period

Eric Ludlam <[email protected]> Thu, 12 Feb 2015 21:44:01 -0500
Newsgroups gmane.emacs.semantic
Message-ID <[email protected]>
On 02/12/2015 06:11 AM, RJD wrote:
> Eric Ludlam <eric <at> siege-engine.com> writes:
>
>
>> That said, if you think the menu should show the variants, and would
>> like to provide a patch for a better version, that is fine with me.  The
>> code should be a very simple change if you look at how 'show variants'
>> works vs the menu function.  Probably just adding a couple symbols as
>> below untested patch.  Doing the same to the completion-tip might be
>> nice too.  I'd recommend trying it out for a while and make sure it
>> doesn't drive you batty first though.  :)
>>
>> Eric
>>
>> === modified file 'lisp/cedet/semantic/ia.el'
>> *** lisp/cedet/semantic/ia.el	2014-11-09 20:23:30 +0000
>> --- lisp/cedet/semantic/ia.el	2014-11-26 17:17:44 +0000
>> ***************
>> *** 157,163 ****
>>       (interactive "d")
>>       (require 'imenu)
>>       (let* ((a (semantic-analyze-current-context point))
>> ! 	 (syms (semantic-analyze-possible-completions a))
>>     	 )
>>         ;; Complete this symbol.
>>         (if (not syms)
>> --- 157,163 ----
>>       (interactive "d")
>>       (require 'imenu)
>>       (let* ((a (semantic-analyze-current-context point))
>> ! 	 (syms (semantic-analyze-possible-completions a 'no-unique 'no-tc))
>>     	 )
>>         ;; Complete this symbol.
>>         (if (not syms)
>>
>> On 11/25/2014 09:23 AM, Dixon Ryan (ETAS/ESW6) wrote:
>>> Hi all,
>>>
>
> Eric,
>
> Sorry to dig up an old thread but I cannot see why people would not want
> variants to show. It is common for C++ to have overloaded constructors and
> the engine (I do not have proof and I am just guessing) seems to pick out
> the first constructor it sees.
>
> I am not sure I understood what you meant clearly about
> ia-semantic-complete-symbol-menu : I always use this - and this is where I
> would like to see all variants: by applying this patch I should be able to?

I believe so.

> I cannot see why people would not want the option is all. Unless, of course,
> it is because people are just using CEDET/Semantic for C code where you
> cannot have overloaded functions.

The routines in "ia" were designed as examples and "how to" for 
developers interested in creating their own completion engines using 
Semantic as the mechanism for calculating them.   As such, I hope to 
keep them relatively clean.  This type of change is still pretty simple, 
so would be fine, but I tend to hesitate adding a lot of complex logic 
that obscures the intent.

In semantic/complete.el, you can use some of the completion commands, 
such as `semantic-complete-jump' to jump to a symbol, and it lets you 
TAB through all the variants.  If you are interested in a specific kind 
of completion, everything you need to jump through variants is there, 
you just need to assemble the right combination of a tag collector and 
display engine for what you want.

Finally, the reason I didn't show the variants is in 2 parts.  1) I 
didn't have variants available when I wrote the ia methods, and 2) since 
I'm only completing the symbol, it doesn't matter what the arguments 
might be.

There are problems where it tries to solve a sequence of symbols such as:

somevar = this.method(Complete_this_arg)

and variants get it in trouble.

Ok, all that said, I'll be happy to review/install tested patches to 
enable such a feature caveat it doesn't obscure the "how to" aspect of 
the code.

Eric

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/