[Github-comments] [geany/geany] Use cxx parser from uctags (PR #3032)

elextr notifications at xxxxx
Tue Dec 7 12:00:00 UTC 2021


Seems to work.

> whether the __anon tags are fine for the sidebar for anonymous declarations

Hmmm, I see what you mean, looking at the typedefs at the start of tm_parser.c the struct is shown as `__anon` and the the typedef then shows later, but there is no link between them.  So AFAICT uses of the typedef can't find the members for autocomplete?

I enabled local variables as you suggested (why I was editing `tm_parser.c` as above) above and yep they are found :-).

But not all (see example below) :-(.

What about function parameters?

These two will help with many simple cases to show options for `local_var.` or `parameter->`, at least in C, so for Geany development.

But its raising the question of how far should we try to go?

Without `project_organiser` or similar to get all symbols in the project, and also the C++ STL, or (for example) libc, GTK and Glib for Geany, we won't get much further than very simple cases.  But then with all symbols gathered the current method of scope free autocomplete becomes unusable due to far too many useless options being presented.  So proper scope tracking is needed.  But scoping also means following the includes, which is not done now, and according to @b4n is very unlikely.

But even with all of those, the trend to inferred types is going to be a big limitation (ok, not for C but for C++  and for other languages that infer types).

For example (showing examples of STL includes and scope and inference):

```cpp
#include <utility>
#include <string>
using namespace std::string_literals;
f(){
    // the type returned from make_pair is inferred from its parameters as std::pair<int, std::string>
    // the types of i and s are inferred by decomposing that return type
    auto [i, s] = std::make_pair(1, "abc"s); 
    // as above but assigning the pair undecomposed
    auto p = std::make_pair(1, "abc"s);
    s.si????
    p.se????
}
```

If I do ctrl+space at the ????s what should autocomplete show (answer "size" and "second").  

But in fact i and s are not parsed as locals currently so "si" gets me tons of Linux signal symbols, and although p is parsed, because it is inferred, ctags gives it no type and no scope autocompletion, so it gets a motley mixture of "se" symbols from C!!!.

Still being able to get explicitly declared locals and parameters would be a big help with Geany :smile:
Especially if we can fix those typedefed __anon structs.
But beyond that is something to leave to the big boys and be happy with the medium capability IMO.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3032#issuecomment-987859719
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20211207/fdaac395/attachment-0001.htm>


More information about the Github-comments mailing list