This pull request updates the python parser to the uctags version. The most interesting things are from the following commit messages from the pull request:
tm_ctags update: ``` The new parser generates 2 tags for import statements like
from A import B
For A tag of the 'i' kind is generated, for B, tag of the kind 'x' is generated. B includes A in its scope and when we omit generation of 'i', imports are printed in the sidebar with the full scope information like
Imports django.views.decorators.csrf.csrf_exempt django.views.decorators.csrf.csrf_exempt2 django.views.decorators.http.require_POST
When we generate 'i' and map it to something (I used tm_tag_externvar_t like for the imports themselves, there's nothing in the tag types we have that would be a good semantic candidate here), the result in the sidebar is
Imports django.views.decorators.csrf csrf_exempt csrf_exempt2 django.views.decorators.http require_POST
which is more readable IMO. ```
cython unit test updates: ``` I'm not sure if cython is officially supported by uctags and there's a slight problem where the new parser omits space between type and function argument name. E.g. it produces
method(self,inti)
instead of
method(self,int i) ```
Not sure if we should worry about the cython output much - we could also drop the cython unit tests if desired. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3031
-- Commit Summary --
* Use uctags version of python * Update mappings in tm_parser.c * Update python unit tests * Update cython tests with a slightly buggy output
-- File Changes --
M ctags/Makefile.am (2) D ctags/parsers/geany_python.c (862) A ctags/parsers/python.c (1597) M src/tagmanager/tm_parser.c (4) M tests/ctags/cython_sample.pyx.tags (6) M tests/ctags/cython_sample2.pyx.tags (2) M tests/ctags/py_constructor_arglist.py.tags (33) M tests/ctags/simple.py.tags (6) M tests/ctags/tabindent.py.tags (2)
-- Patch Links --
https://github.com/geany/geany/pull/3031.patch https://github.com/geany/geany/pull/3031.diff
Looks great. I already fell in love with the new import parsing, just to show my enthusiasm: ![Screenshot_2021-11-28_14-07-33](https://user-images.githubusercontent.com/617017/143769273-0a9d4a34-52b3-49f...) 😄
I'm also not sure about Cython but if it was ok for uctags, it's probably also ok for us.
Great, happy you like it!
I created a bug report for the cython problem here https://github.com/universal-ctags/ctags/issues/3216 and added a patch in #2991 that allows us to disable certain kinds in ctags ('z' in this case) which resolves the problem for us.
@techee pushed 1 commit.
8915fe4f51990a0f00d0aae1e69d851b35ed3051 Improve output of 'import A as B'
Just tested and the new parser fixes these issues: #357, #612, #1337, #1390, #1417, #1943, #1996.
@techee pushed 1 commit.
bcf3c890c2e676f11de26bfd808777dfeae15889 Merge branch 'master' into python_sync
@techee pushed 1 commit.
ab90aed13256c24db1dc936396cbaa15df238b57 Update the cython unit tests to the correct output
@techee pushed 1 commit.
3f30df6657f42b7e677b404c0af44362c66d9d4c Merge branch 'master' into python_sync
@eht16 @elextr OK if I merge this PR together with my other open "ctags parser" PRs? This has been open for 3 months and I don't think maturing PRs like a fine wine helps anything. I guess nobody is against using upstream parsers in general, the changes on the Geany side are pretty minimal, mostly just Makefile updates and kind mapping updates and there's not much to review IMO. I'd really like 2022 to be the year when the ctags sync and TM stuff gets finished, we are pretty close I believe and these open PRs block me from other work.
Yes, please. I'm fine with it!
Since I had a Python (the snake) in the back yard last weekend its clearly an omen that this should go ahead :smile:
@eht16 is our best snake catcher, so if he is happy its fine.
I'm fine. Please make sure to rebase your branch in order to remove the back-merges before merging.
@techee pushed 4 commits.
37f76c9a7b593f266104777b13dc61be5314fe48 Use uctags version of python 83c0439cec5616f2fe27e553fdc0d5b2617debe7 Update mappings in tm_parser.c 72f0b6e8ec400f54047d48aa292a7172fb683c6d Update python unit tests 33b3e776030d822e0306a71416feb1f3d809c76d Improve output of 'import A as B'
Merged #3031 into master.
OK, done.
@kugel- With the merges I probably introduced some changes that should be addressed in your meson build branch. It should be easy to fix though - it's mainly the removal of the `ctags_` prefix from some parser files and also some parsers now have the corresponding header file which wasn't present before.
github-comments@lists.geany.org