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

Jiří Techet notifications at github.com
Thu Apr 21 13:31:58 UTC 2022


> This may be true for well-written, valid code. But we deal with code that's just being written, and in that case it can absolutely be useful to autocomplete later declarations, perhaps knowing that I need to move the declaration upwards after finishing this line.

Can do that. On the one hand I don't think it's so common to have a variable declared after its use (I typically forget to declare it altogether), on the other hand there will hopefully not be too many variables with the same name declared in the same function that this would cause problems.

Also consider this:
```
void foo()
{
	Foo a;
	if (true)
	{
		Bar a;
		if (true)
		{
			Baz a;
		}
	}
	// <-- cursor here
	if (true)
	{
		Bar2 a;
		if (true)
		{
			Baz2 a;
		}
	}
}
```
We don't get nesting information for local variables by ctags - all the `a` variables in the above code have the same scope returned by ctags. So by removing some of them we may at least reduce the danger that the wrong one is used.

> I don't think we apply that logic to global tags like static variables, do we? Like, I can autocomplete a call to foo() even if its declaration is later in the file?

No, we don't, I added it just for the local variables.


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

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


More information about the Github-comments mailing list