This patch also updates update-ctags.py to update parsers in the optlib directory.
I'm not sure if the meson parser should use some icons for the groups in the sidebar or not, I chose the icon-free variant.
Fixes https://github.com/geany/geany/issues/4002 You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/4013
-- Commit Summary --
* Use Forth and Meson optlib-based ctags parsers
-- File Changes --
M ctags/Makefile.am (2) A ctags/optlib/forth.c (76) A ctags/optlib/meson.c (261) M data/filedefs/filetypes.Meson.conf (1) M meson.build (2) M scripts/update-ctags.py (7) M src/filetypes.c (2) M src/tagmanager/tm_parser.c (36) M src/tagmanager/tm_parser.h (2) M src/tagmanager/tm_parsers.h (4)
-- Patch Links --
https://github.com/geany/geany/pull/4013.patch https://github.com/geany/geany/pull/4013.diff
Cool! Tested with Meson and looks great.
Two minor questions: - why did you choose against icons? Maybe we can try to match some of the Makefile mapping, e.g. "targets" seem to have a similar meaning. - is it useful to list the variables as symbols? This can get many quickly, I tested with GLib's meson.build and there the list is pretty long.
> why did you choose against icons? Maybe we can try to match some of the Makefile mapping, e.g. "targets" seem to have a similar meaning.
It's not because of the icons themselves but because there's no clear semantic mapping of the kinds provided by meson and icon names (which are tailored to programming languages) - so I wasn't sure what to use. If you have some suggestions which icons to use for which kinds, no problem to add them.
> is it useful to list the variables as symbols? This can get many quickly, I tested with GLib's meson.build and there the list is pretty long.
OK, these can be removed (or mapped to local variables which aren't shown in the sidebar so symbol goto still works for them).
> > why did you choose against icons? Maybe we can try to match some of the Makefile mapping, e.g. "targets" seem to have a similar meaning. > > It's not because of the icons themselves but because there's no clear semantic mapping of the kinds provided by meson and icon names (which are tailored to programming languages) - so I wasn't sure what to use. If you have some suggestions which icons to use for which kinds, no problem to add them.
I'm not sure either, maybe: ```c static TMParserMapGroup group_MESON[] = { {N_("Projects"), TM_ICON_CLASS, tm_tag_namespace_t}, {N_("Modules"), TM_ICON_NAMESPACE, tm_tag_package_t}, {N_("Variables"), TM_ICON_NONE, tm_tag_variable_t}, {N_("Subdirs"), TM_ICON_OTHER, tm_tag_macro_t}, {N_("Build Targets"), TM_ICON_METHOD, tm_tag_other_t}, {N_("Custom Targets"), TM_ICON_METHOD, tm_tag_enumerator_t}, {N_("Benchmark Targets"), TM_ICON_METHOD, tm_tag_function_t}, {N_("Run Targets"), TM_ICON_METHOD, tm_tag_member_t}, {N_("Tests"), TM_ICON_NONE, tm_tag_field_t}, }; ``` - Modules -> TM_ICON_NAMESPACE: as modules here are somewhat similar to imports in Python, so use the same icon as in Python - *Targets -> TM_ICON_METHOD: same semantic as in Makefile, so use the same icon as there - the others are just to be filled and "Tests" left empty (assuming most Meson files won't have tests :D)
But as you see, this is also more or less arbitrary. We don't need to add them at all.
> > is it useful to list the variables as symbols? This can get many quickly, I tested with GLib's meson.build and there the list is pretty long. > > OK, these can be removed (or mapped to local variables which aren't shown in the sidebar so symbol goto still works for them).
:+1:
@techee pushed 2 commits.
d7bc7960355a7dc06cb46a6df4c728146c5160a8 Use Forth and Meson optlib-based ctags parsers e9a73c411ed3122570ebc9226411d0733c1a312e Fix current_scope value passed to tm_workspace_is_autocomplete_tag()
> I'm not sure either, maybe...
Thanks, I've just used that.
> the others are just to be filled and "Tests" left empty (assuming most Meson files won't have tests :D)
Yes, we should do our best to discourage users from writing those :-).
> or mapped to local variables which aren't shown in the sidebar so symbol goto still works for them
I did just that, but there was a minor problem I had to fix - see the second commit. Goto works fine now and variables aren't shown in the sidebar.
Cool.
Now I get: ``` process:641255): Tagmanager-WARNING **: 11:35:25.312: Not all tag types mapped to symbol tree groups for Meson ```
The warning disappears when we use `tm_tag_local_var_t` for "Variables" member in `group_MESON`. Goto still works this way but I'm not sure if this is a valid "fix" or this might have other side effects?
If this is not valid and causes more troubles, I think, it is ok to just show variables in the symbol tree as before.
@techee pushed 1 commit.
7b8fa68b582989e1c3ee3435f27f1db65b4aebf8 Add tm_tag_local_var_t into the "Variables" group
> The warning disappears when we use tm_tag_local_var_t for "Variables" member in group_MESON. Goto still works this way but I'm not sure if this is a valid "fix" or this might have other side effects?
Yes, this is a valid fix, it has to appear in some group (in fact, it could be added to any of the groups, since local variables aren't displayed, it doesn't matter).
I added this warning to Geany so we don't forget to update groups when new kinds are introduced in which case symbols wouldn't be displayed in the sidebar.
@eht16 approved this pull request.
Merged #4013 into master.
github-comments@lists.geany.org