[Github-comments] [geany/geany] Enable local variable and function parameter tag reporting for C/C++ (PR #3175)

elextr notifications at github.com
Sun Apr 24 14:56:25 UTC 2022


> It was about ordering tags before processing them by the scope autocompletion code, not about ordering results.

Ahhhhh, gotcha.

> If you have some bigger C++ project around it would be interesting to see how the autocompletion behaves for it when you load all its tags.

I tried my current project, I just loaded all the .hpp files (just select all in the `include` directory so no ProjectOrganizer needed) and a bunch of cpp files.  

The problem is almost no locals have a type because they are inferred (ie declared `auto`) and that is way above ctags pay grade to get those types, and so no scope autocomplete on . or -> to find out which tag was chosen.  I guess that means the local was chosen, but its impossible to be sure.  

Also my local names and member names tend not to overlap, (members have long names like `current_token` but locals are short like `a`) but deliberately creating a local the same name as a member does indeed give scope autocomplete for the local, not the member of the same name, and for the member when the local declaration is removed, which is correct.

> Sorting local variables above the rest of the tags would be possible for non-scope autocompletion (with scope autocompletion you get members which are never local).

That would be good.

An example in the project I tested is that inside a function I have a local `count` so typing `co` ctrl+space gives a list including things like `conj`, `conjf`, ... `cookie_close_function_t`, `cookie_io_function_t` ...`cos`, `cosf`, `cosh`, `coshf`, `coshl`, `cosl`, `count`.  The one I want is dead last.  What the `cookie_..._function_t` is about I don't know, it must be from the C/C++ global tags file where `cos` etc come from.  So sorting locals, then members, then globals would be much more usable.

Typing `co` ctrl+space at exactly the same place in the same file in Eclipse gets many of the same names plus some more, (including the cookie monsters), but grouped by a whole lot of groups like local var, global var, typedef, class, struct, member var, member function, global function etc each sorted alphabetical, but it has an icon on each name making the groups obvious.  I believe Scintilla can [display them too](https://www.scintilla.org/ScintillaDoc.html#SCI_REGISTERIMAGE).   Eclipse also has an option to alphabetise the autocomplete list ignoring groups, but the icon, and the fact the type is shown for variables (the inferred type, but Geany can't do that, we would just have "auto"), makes it easier to find what I want when its plain alphabetic.

Showing icons would help to reduce possible confusion about groups.

> It's not really a function code, it's an object with operator () that is callable thanks to this. And the tooltip code doesn't take this into account.

Its just a member function like any other, but with a funny name.   Thats what I mean by "determining function calls".  I presume at the moment the tooltips code finds the tag for `foo`, and it ignores all but function/method tags.  But for C++ it should also to notice it is a variable of a class with an operator() member function and tooltip that.  And also if the tag says its a class name, then the tooltip should show the constructor if it has one.  But as I said, so long as the tags support that then its tooltip code not this PR.  We really should separate some of this language specific stuff into a plugin "someday".

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3175#issuecomment-1107857529
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/3175/c1107857529 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20220424/8491ade4/attachment.htm>


More information about the Github-comments mailing list