bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem on generating GRTAGS for vim scripts


From: Shigio YAMAGUCHI
Subject: Re: Problem on generating GRTAGS for vim scripts
Date: Sat, 5 Jun 2021 10:52:33 +0900

> In other words, how pygments-parser get the symbol from pygments...

pygments-parser calls pygments.lexers module.
Please see the source code of the parser.

[installed]
/usr/local/share/gtags/script/pygments_parser.py
[in the source package]
plugin-factory/pygments_parser.py.in

Regards,
Shigio

On Fri, Jun 4, 2021 at 11:43 PM John Rama <john.rama01@gmail.com> wrote:
>
> Thanks Shigio-san for clarifying the problem in detail.
>
> > I think the only way to fix it fundamentally is to rewrite one of the 
> > parsers.
> I agree.
>
> I personally think this is the problem on Pygments. So, would like to try to 
> dug into it.
>
> Is there any way to make pygments generate the symbol ?
>
> Following command generated highlighted text.
> $python3 -m pygments plugin/lightline.vim
>
> I am wondering if there is any option to generate symbol only...
> In other words, how pygments-parser get the symbol from pygments...
>
> John
>
> On 2021/06/03 20:36, Shigio YAMAGUCHI wrote:
> > Hello,
> >
> >> Is this expected behavior ?
> >
> > No, it isn't. It is a bug.
> >
> > 'pygments-parser.la' works by combining two parsers: Pygments and Ctags.
> > It seems that the parsers recognize symbols differently.
> > Ctags picks up symbols with namespace but Pygments do it without namespace.
> >
> > Ctags           lightline#highlight
> > Pygments        highlight
> >
> >> Is there any workaround on this ?
> >
> > You can pick up both symbols using a regular expression 'highlight$'.
> > ('$' matches the end of the symbol.)
> >
> > $ global -x 'highlight$'
> > lightline#highlight  263 autoload/lightline.vim function!
> > lightline#highlight(...) abort
> > ...
> >
> > $ global -xrs 'highlight$'
> > highlight          54 autoload/lightline.vim     autocmd
> > SessionLoadPost * call lightline#highlight()
> > highlight          56 autoload/lightline.vim           \ | call
> > lightline#update() | call lightline#highlight() | endif
> > ...
> >
> > 'global -xr' does not work, since global cannot understand that
> > 'lightline#highlight' and 'highlight' are in a reference relationship.
> > I think the only way to fix it fundamentally is to rewrite one of the 
> > parsers.
> >
> > Regards,
> > Shigio
> >
> > 2021年6月4日(金) 5:35 John Rama <john.rama01@gmail.com>:
> >
> >>
> >> Hi,
> >>
> >> I keep using global/gtags for reading c/python/javascripts and it
> >> works greatly. Thank you for that !!
> >>
> >> But when trying to create tags files for vim script,
> >> GTAGS files are generated correctly, but GRTAGS files are not
> >> complete.
> >>
> >> - Environement
> >>     $gtags --version
> >>     gtags (GNU GLOBAL) 6.6
> >>     $python3 -m pip list |grep Pygments
> >>     Pygments   2.9.0
> >>
> >> - How to duplicate the problem
> >>     $git clone  https://github.com/itchyny/lightline.vim
> >>     $gtags --gtagslabel=pygments -v
> >>
> >> - Problem
> >>     For example, symbol for lightline#highlight() is generated in GTAGS
> >>     file, but it's not in GRTAGS.
> >>     So, it looks lightline#highlight symbol becomes "highlight".
> >>
> >>     $gtags -d GTAGS |grep high
> >>     lightline#highlight     42 @n 263 function! @n(...) abort
> >>     s:suite 51 @n 1 let @n = themis#suite('highlight')
> >>     suite.highlight 51 @n 21 function! s:@n()
> >>
> >>     $gtags -d GRTAGS |grep high
> >>     highlight       51 @n 21,19,17,16
> >>     highlight       42 @n 54,2,146-1,21-1,38,7,40-1,121-1
> >>     highlight       3 @n 22,2
> >>
> >> - Questions
> >> Is this expected behavior ?
> >> Is there any workaround on this ?
> >>
> >> Thanks for your help.
> >> John
> >>
> >>
> >
> >
> > --
> > Shigio YAMAGUCHI <shigio@gnu.org>
> > PGP fingerprint:
> > 26F6 31B4 3D62 4A92 7E6F  1C33 969C 3BE3 89DD A6EB
> >
>


-- 
Shigio YAMAGUCHI <shigio@gnu.org>
PGP fingerprint:
26F6 31B4 3D62 4A92 7E6F  1C33 969C 3BE3 89DD A6EB



reply via email to

[Prev in Thread] Current Thread [Next in Thread]