[Github-comments] [geany/geany] Enable local variables for C/C++ and improve autocompletion (PR #3185)

Jiří Techet notifications at github.com
Sat Apr 30 21:49:33 UTC 2022


@techee commented on this pull request.



>  	foreach_ptr_array(tmtag, i, tags)
 	{
+		if (tmtag->type & tm_tag_local_var_t &&
+			(doc->tm_file != tmtag->file ||
+			 current_line < tmtag->line ||

> tm_parser_var_valid_before_declare() should be called here, no?

In fact, I'm less convinced whether `tm_parser_var_valid_before_declare()` is a good idea now - even though you can declare (i.e. assign) variables after their first appearance in file, I think this pattern is not so common and like in the C/C++ case because of this you will get invalid variables in the autocompletion in many cases which IMO is not worth it.

> Also, the whole condition is basically a duplicate of the same in is_valid_autocomplete_tag(). Can is_valid_autocomplete_tag() be made callable from here (perhaps with a different name)?

I was thinking about it but there's small difference - while with autocompletion we have only prefix, here we have the whole symbol name so less "false positives" in the result so I thought I could leave it this way. In any case, I don't have a strong opinion about this and these two could indeed be unified. This function could go to tm_tag.c.



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

Message ID: <geany/geany/pull/3185/review/958522601 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20220430/cb42ce4a/attachment.htm>


More information about the Github-comments mailing list