This PR contains some ctags updates which were made upstream as discussed in https://github.com/geany/geany/pull/3859.
Apart from that I noticed that the `update-ctags.py` script didn't copy the updated libreadtags library so I modified it to do so and as a result this PR also contains updated readtags.c/h which was missed in the previous PR. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3877
-- Commit Summary --
* update-ctags.py: Also copy the readtags library * Update ctags to p6.1.20240519.0 * Add missing powershell mapping * Update matlab unit test output
-- File Changes --
M ctags/libreadtags/readtags.c (298) M ctags/libreadtags/readtags.h (20) M ctags/main/repoinfo.h (2) M ctags/parsers/jscript.c (96) M ctags/parsers/matlab.c (11) M ctags/parsers/pascal.c (11) M ctags/parsers/powershell.c (35) M scripts/update-ctags.py (4) M src/tagmanager/tm_parser.c (1) M tests/ctags/matlab_test.m.tags (4)
-- Patch Links --
https://github.com/geany/geany/pull/3877.patch https://github.com/geany/geany/pull/3877.diff
Just thinking, in https://github.com/geany/geany/pull/3859 I mapped matlab variables to `tm_tag_variable_t` so they are displayed in the sidebar but maybe the result is a little too verbose. Especially since it generates a tag for every variable assignment - I just tried it with some random code from github and it displays lots of identical variables in the sidebar, just every time the variable gets assigned.
So shouldn't we rather map it to `tm_tag_undef_t`?
Python does this too, every assignment is a new declaration and shows in the sidebar, on the other hand Julia (where assignment is also declaration) has chosen not to show any assignments in the sidebar, YMMV.
Python does this too, every assignment is a new declaration and shows in the sidebar
Yes, but this happens only for the global variables, not variables inside functions. Since the matlab parser is just a dumb regex parser, it doesn't know whether it's inside a function so it shows all assignments and the result is a little too noisy.
it doesn't know whether it's inside a function so it shows all assignments and the result is a little too noisy.
Yeah, if they are not scoped then its not very useful.
@b4n commented on this pull request.
Wanna laugh? https://github.com/universal-ctags/ctags/pull/4008 :smile:
@@ -951,6 +951,7 @@ static TMParserMapEntry map_POWERSHELL[] = {
{'c', tm_tag_class_t}, // class {'i', tm_tag_function_t}, // filter {'g', tm_tag_enum_t}, // enum + {'e', tm_tag_undef_t}, // enumlabel
Should be mapped to `tm_tag_enumerator_t`, shouldn't it? It's usually mapped to `"Variables"` / `TM_ICON_VAR` apparently (but here enumerators are always gonna have a parent).
Just thinking, in #3859 I mapped matlab variables to `tm_tag_variable_t` so they are displayed in the sidebar but maybe the result is a little too verbose. Especially since it generates a tag for every variable assignment - I just tried it with some random code from github and it displays lots of identical variables in the sidebar, just every time the variable gets assigned.
So shouldn't we rather map it to `tm_tag_undef_t`?
Hum yeah if it's gonna tag every variable assignment in the file regardless of scope, it's probably better to disable indeed, otherwise the more useful tags are likely gonna be hard to find. Maybe `tm_local_var_t` if we want, to still have goto stuff? Not sure if it's really useful though.
@techee pushed 3 commits.
834d81ce2b8ddcc495f70eb65ed2809689a7b47d Map powershell enumlabel to tm_tag_enumerator_t ca9789473ad32a696d8f6bc712b4631bbf86f159 Map Matlab variables back to tm_tag_undef_t e01d7c4f00f0c168326568cdc17e2b3d6341351a Update to the latest jscript parser which contains some fixes
@techee commented on this pull request.
@@ -951,6 +951,7 @@ static TMParserMapEntry map_POWERSHELL[] = {
{'c', tm_tag_class_t}, // class {'i', tm_tag_function_t}, // filter {'g', tm_tag_enum_t}, // enum + {'e', tm_tag_undef_t}, // enumlabel
Done.
So shouldn't we rather map it to tm_tag_undef_t?
Hum yeah if it's gonna tag every variable assignment in the file regardless of scope, it's probably better to disable indeed, otherwise the more useful tags are likely gonna be hard to find. Maybe tm_local_var_t if we want, to still have goto stuff? Not sure if it's really useful though.
I just mapped it to `tm_tag_undef_t`. Even though mapping to `tm_local_var_t` would probably work, control-clicking a variable that is assigned many times creates a huge popup with all the assignments which is kind of ugly.
Wanna laugh? https://github.com/universal-ctags/ctags/pull/4008 😄
No problem. I've just included the updated jscript parser (without updating the rest). We can update the parsers individually if there are some fixes that should be present in the release.
Merged #3877 into master.
github-comments@lists.geany.org