I'm trying to index the Pascal files of a project, on Linux (modern Ubuntu).
I've followed the instructions, but I'm very confused because of several factors.
The procedure I've applied is:
$ apt install global exuberant-ctags
$ python3 -m pip install pygments
$ gtags --version
gtags (GNU GLOBAL) 6.6.4
Now, things start to get confusing, because first, there is no gtag.conf anywhere in the system.
There is a /usr/share/doc/global/examples/gtags.conf.gz
, which says, at the top:
Basically, GLOBAL doesn't need this configuration file ('gtags.conf'),
because it has default values in itself. [...]
I ignore this comment, and run:
gzip -dc /usr/share/doc/global/examples/gtags.conf.gz > /tmp/gtags.conf
export GTAGSCONF=/tmp/gtags.conf
export GTAGSLABEL=pygments
gtags -v
I can see from the output:
[Sat Aug 13 13:57:58 CEST 2022] Gtags started.
Using configuration file '/tmp/gtags.conf'.
Using configuration label 'pygments'.
Using plug-in parser.
[Sat Aug 13 13:57:58 CEST 2022] Creating 'GTAGS' and 'GRTAGS'.
[1] extracting tags of FILE1.ASM
[2] extracting tags of FILE2.ASM
[Sat Aug 13 13:57:58 CEST 2022] Done.
That no PAS files are included.
I try to follow the instructions from the official tutorial:
find . -name '*.PAS' > /tmp/list
gtags -vf /tmp/list
And the output doesn't include any file, essentially:
[Sat Aug 13 14:01:44 CEST 2022] Gtags started.
Using configuration file '/tmp/gtags.conf'.
Using configuration label 'pygments'.
Using '/tmp/list' as a file list.
Using plug-in parser.
[Sat Aug 13 14:01:44 CEST 2022] Creating 'GTAGS' and 'GRTAGS'.
[Sat Aug 13 14:01:44 CEST 2022] Done.
Now, I try to rename the PAS
files to pas
(or add .PAS
to the gtags.conf
file). It seems to get better:
$ gtags -v
[Sat Aug 13 14:04:57 CEST 2022] Gtags started.
Using configuration file '/tmp/gtags.conf'.
Using configuration label 'pygments'.
Using plug-in parser.
[Sat Aug 13 14:04:57 CEST 2022] Creating 'GTAGS' and 'GRTAGS'.
[1] extracting tags of FILE1.ASM
[2] extracting tags of FILE2.pas
[... all relevant files ...]
[Sat Aug 13 14:04:58 CEST 2022] Done.
But gtags seems no to index anything relevant, since this:
$ gtags -vf FILE2.pas
results in a big list of lines marked as not found. ignored.
What confuses me is that it seems that Global is not able to parse Pascal files for some reason, but on the other hand, I don't get any error (which I suppose is relate to Pygments).
The "gtags
" command generates the index.
gtags -vf relevant.lst
expects a list of files inside relevant.lst.
To query contents of a file, you must use "global
" command.
E. g. global -c function_na
should give you completed function_name
as result (provided there is such function in your code)