yoshizow / global-pygments-plugin

[DEPRECATED] Pygments Plug-in Parser for GNU GLOBAL
Other
66 stars 16 forks source link

Can't generate references with pygments combined with universal-ctags #10

Closed hisnawi closed 6 years ago

hisnawi commented 7 years ago

Hi, I have this in my gtags.conf under my projects root directory:

default:\
    :tc=new-ctags:tc=pygments:
native:\
    :tc=gtags:tc=htags:
user:\
    :tc=user-custom:tc=htags:
ctags:\
    :tc=exuberant-ctags:tc=htags:
new-ctags:\
    :tc=universal-ctags:tc=htags:
pygments:\
    :tc=pygments-parser:tc=htags:

Unfortunately, I am not able to generate references.

But if I change:

default:\
    :tc=new-ctags:tc=pygments:

to:

default:\
    :tc=gtags:

Then I can generate references no problem.

How can I combine universal-ctags and pygments(for generating references)?

yoshizow commented 7 years ago

I'm not familiar with universal-ctags, but will try to explain some facts.

When you specify like this,

default:\
    :tc=new-ctags:tc=pygments:

Files that can be processed by universal-ctags are processed by new-ctags plugin, then rest is processed by pygments plugin. Every file is processed by exactly one plugin. You can run gtags --explain to show which file is handled by which plugin.

As far as I know, universal-ctags can generate reference tags. (cf. http://docs.ctags.io/en/latest/news.html#reference-tags) So if you want to generate references, you will not need pygments plugin.

hisnawi commented 7 years ago

Thank you very much. That is why I am confused why universal-ctags is not generating the references.

I followed the link that you sent me, and added these lines:

--extras=+r
--fields=+r

to .ctags file. It still does not generate references. Not sure how this gets debugged.

masatake commented 7 years ago

As I wrote in https://github.com/universal-ctags/ctags/issues/1453, the ability of generating reference tags of u-ctags is very limited. u-ctags has infrastructures for gathering reference tags but only a few parsers utilize the subset of infrastructures.

hisnawi commented 7 years ago

@masatake So it is not possible for me to have universal-ctags do the regular parsing and have pygments/gtags do the referencing part?

I mean, I am still not sure how come gtags on its own includes correct (global style) references and gtags --gtagslabel=new-ctags (universal-ctags) can't

masatake commented 7 years ago

@masatake So it is not possible for me to have universal-ctags do the regular parsing and have pygments/gtags do the referencing part?

I'm sorry but I don't know how to combine them.

yoshizow commented 7 years ago

I checked universal-ctags and figured out how to use it.

So it is not possible for me to have universal-ctags do the regular parsing and have pygments/gtags do the referencing part?

@hisnawi If you want to do this, you need to configure like this.

default:\
    :tc=pygments:

With this config, pygments plugin will automatically invoke universal-ctags to collect definitions. It will also collect references, then combine both results.

If this doesn't work, please make sure pygments plugin is configured with correct path for universal ctags binary:

$ grep ^EXUBERANT_CTAGS /usr/local/share/gtags/script/pygments_parser.py
EXUBERANT_CTAGS = "/usr/local/bin/ctags"

(Path may vary.) In this case, please check if /usr/local/bin/ctags is the correct path for your universal ctags installation.

hisnawi commented 6 years ago

That worked. Thanks.