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

Jiří Techet notifications at github.com
Sun Apr 24 10:50:13 UTC 2022


> Since types must be declared before use, members that use public types need to go after that definition, and if the type is public and the data member private, its a common idiom to put those data members in one private section at the end of the class declaration rather than swapping back and forth all the time.

Once again - the "ignore variables after the current line" thing is for _local variables only_ (that is, variables declared inside a single function). It doesn't apply to members. Anyway, no problem to remove it. As @kugel- pointed out, the possible problem could be when refactoring/writing a not yet compiled code and having the variable declared after the current location by accident. I'm still a bit hesitant about how common problem this is and if we should support invalid code (which we don't already, a single extra `{` breaks ctags parsing). But OK, let's remove this condition.
```
		if(p){           // autocompletes p first but with lots of C library crap
...
		pit = 1;         // autocompletes with ctrl space after p 
		                 // but with pid_t before pit in list
...
```
This is normal autocompletion (scope autocompletion only happens when you type `.` or `->`) where the result contains all tags.

```
	foo();  // no tooltip for foo(
```
I haven't done anything regarding tooltips. Tooltips right now just look at corresponding function calls which `foo` isn't. Could probably be improved.

> As noted there are some places where the sorting seems questionable.

The sorting is alphabetical, like in the symbol tree (capitals first). I haven't done anything regarding the sorting of the results and I don't really have any smart idea how to (simply) guess what the user wants.

> Also constructors, Foo() above, should not show in . or -> completions lists (p-> in main() above), they can't be called like that. Destructors can and show ok.

Constructors are reported by ctags as methods so we see them in the same way as methods. We could probably detect them by checking if the "function" name is the same as the name of the class and filter them out.

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

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


More information about the Github-comments mailing list