Re: Q on global/gtags with rust codes

Makoto Harada <[email protected]> Thu, 26 Oct 2023 17:26:39 -0400
Newsgroups gmane.comp.gnu.global.bugs
Message-ID <[email protected]>
Hi, Shigio-san,

I'm now trying to investigate deeply on this.

I have one favor.
Can you share the version of Pygments and ctags in your environment, 
where you can tag rust files without any problem ?
I am suspecting some of them are different between you and me.

Here is mine.
Thanks !!

Makoto

==================================================
$python3 -m pip list |grep  Pygments
Pygments               2.11.2

$/usr/bin/ctags --version
Exuberant Ctags 5.9~svn20110310, Copyright (C) 1996-2009 Darren Hiebert
   Addresses: <[email protected]>, http://ctags.sourceforge.net
   Optional compiled features: +wildcards, +regex

==================================================

On 10/19/2023 8:37 PM, Shigio YAMAGUCHI wrote:
> Harada san,
>> May I ask which environment are you using ?
>> In your environment, these works as expected ?
> My execution results are as follows:
>
> $ gtags --version -q
> 6.6.10
> $ gtags --gtagslabel=pygments
> $ global -f main.rs --gtagslabel=pygments
> main                3 main.rs          fn main() {
> calculate_weight_on_mars   14 main.rs          fn
> calculate_weight_on_mars(weight: f32) -> f32 {
> $ global -c
> calculate_weight_on_mars
> main
> $ global -s 'println!'
> main.rs
>
> Global above is the released version of 6.6.10 without the
> modification of pygments_parser.py.
> The failure occurring in your environment is not reproduced in mine.
>
>> Do you have any idea why older version  like 6.6.7(released on 2021/7/1)
>> or 6.6.4 have these issue ?
> Verion 6.6.10 and the prior contain the same bug. But it doesn't seem to be
> relevant to this case. Please forget the bug.
>
> Regards,
> Shigio
>
> On Fri, Oct 20, 2023 at 6:50 AM Makoto Harada <[email protected]> wrote:
>>
>> Additional information.
>>
>> It looks GPATH and GRTAGS are created correctly, but GTAGS are not....
>>
>> This is true with and without modification of
>> /usr/local/share/gtags/script/pygments_parser.py.
>> This is true with the latest global version(6.6.10) and old version(6.6.7).
>>
>> ===========================================
>> $gtags -d GPATH
>>    __.NEXTKEY     2
>>    __.VERSION      __.VERSION 2
>> ./main.rs       1
>> 1       ./main.rs
>>
>> $gtags -d GRTAGS
>>    __.COMPACT      __.COMPACT
>>    __.COMPLINE     __.COMPLINE
>>    __.COMPNAME     __.COMPNAME
>>    __.VERSION      __.VERSION 6
>> String  1 @n 5
>> calculate_weight_on_mars        1 @n 10,4
>> input   1 @n 5,2,2
>> io      1 @n 1,6
>> main    1 @n 3
>> mars_weight     1 @n 10-1
>> new     1 @n 5
>> parse   1 @n 9
>> println!        1 @n 4,7
>> read_line       1 @n 7
>> std     1 @n 1
>> stdin   1 @n 7
>> trim    1 @n 9
>> unwrap  1 @n 7,2
>> weight  1 @n 9-1,4-1
>>
>> $gtags -d GTAGS
>>    __.COMPNAME     __.COMPNAME
>>    __.COMPRESS     __.COMPRESS ddefine ttypedef
>>    __.VERSION      __.VERSION 6
>>
>> ===========================================
>>
>> Makoto
>>
>> On 10/19/2023 10:44 AM, Makoto Harada wrote:
>>> Shigio-san,
>>>
>>> Thanks for your continuous help here.
>>>
>>>> Perhaps the following command will work correctly, I think.
>>>> Would you please try this?
>>>>
>>>> $ global -f main.rs --gtagslabel=pygments
>>>> $ global -r 'println!'
>>> I tried, but the result is the same.
>>>
>>> May I ask which environment are you using ?
>>> In your environment, these works as expected ?
>>>
>>>>> The cause of the problem was not in Universal Ctags, but in my
>>>>> insufficient
>>>>> bug fixes for the following issues:
>>>>>
>>>>> Universal Ctags: Don't read config files; New 'ctagsoptfile'
>>>>> configurati
>>>>> Date:   Fri, 07 Apr 2023 13:07:07 +0200
>>>>>
>>>>> The workaround is still valid.
>>>> I also tried with global older version, 6.6.7 and got the same result.
>>>> In my understanding, 6.6.7 was released before the fix above.
>>>> So, I'm suspecting that there might be another root cause...
>>> Do you have any idea why older version  like 6.6.7(released on
>>> 2021/7/1) or 6.6.4 have these issue ?
>>>
>>> Makoto
>>>
>>> On 10/18/2023 11:17 PM, Shigio YAMAGUCHI wrote:
>>>> Perhaps the following command will work correctly, I think.
>>>> Would you please try this?
>>>>
>>>> $ global -f main.rs --gtagslabel=pygments
>>>> $ global -r 'println!'
>>>>
>>>> Instead of '--gtagslabel=pygments', you can use
>>>> GTAGSLABEL environment variable.
>>>> I have no idea about 'global -c'.
>>>>
>>>> Regards,
>>>> Shigio
>>>>
>>>> On Thu, Oct 19, 2023 at 11:00 AM Harada Makoto <[email protected]>
>>>> wrote:
>>>>> Shigio-san,
>>>>>
>>>>> Tried adding '--options=NONE' to the beginning, however got the same
>>>>> result, unfortunately...
>>>>> (Tested with different environment this time. (Version 6.6.4))
>>>>>
>>>>> ==============================================================
>>>>> $gtags -v
>>>>> [Wed Oct 18 21:55:26 EDT 2023] Gtags started.
>>>>>    Using configuration file '/Users/makoto/.globalrc'.
>>>>>    Using configuration label 'default'.
>>>>>    Using plug-in parser.
>>>>> [Wed Oct 18 21:55:26 EDT 2023] Creating 'GTAGS' and 'GRTAGS'.
>>>>>    [1] extracting tags of main.rs
>>>>> No options will be read from files or environment
>>>>> [Wed Oct 18 21:55:27 EDT 2023] Done.
>>>>>
>>>>> $global -c
>>>>> $global -f main.rs
>>>>> No options will be read from files or environment
>>>>> $global -r println
>>>>> $global -gx println
>>>>> println             4 main.rs              println!("Enter your
>>>>> weight (kg): ");
>>>>> println            14 main.rs              println!("Weight on Mars:
>>>>> {}kg", mars_weight);
>>>>>
>>>>> $global --version
>>>>> global (GNU GLOBAL) 6.6.4
>>>>> ==============================================================
>>>>>
>>>>> Makoto
>>>>>
>>>>>> 2023/10/18 21:24、Shigio YAMAGUCHI <[email protected]>のメール:
>>>>>>
>>>>>> Could you please try adding '--options=NONE' to the beginning?
>>>>>>
>>>>>> [/usr/local/share/gtags/script/pygments_parser.py]
>>>>>> 142: self.process = subprocess.Popen([ctags_command, '-xu',
>>>>>> '--tag-relative=no',...
>>>>>> |
>>>>>> v
>>>>>> 142: self.process = subprocess.Popen([ctags_command, '--options=NONE',
>>>>>> '-xu', '--tag-relative=no',...
>>>>>>
>>>>>> Regards,
>>>>>> Shigio
>>>>>>
>>>>>> On Wed, Oct 18, 2023 at 11:19 PM Makoto Harada <[email protected]>
>>>>>> wrote:
>>>>>>> Shigio-san,
>>>>>>>
>>>>>>> Thanks for your prompt reply and your help here.
>>>>>>>
>>>>>>> I made the change
>>>>>>> /usr/local/share/gtags/script/pygments_parser.py  as
>>>>>>> you suggested,
>>>>>>> and did the same test, however it did not help unfortunately.
>>>>>>> I got the same result before the change.
>>>>>>> I also confirmed that
>>>>>>> /usr/local/share/gtags/script/pygments_parser.py
>>>>>>> is called and executed.
>>>>>>>
>>>>>>>
>>>>>>>> The cause of the problem was not in Universal Ctags, but in my
>>>>>>>> insufficient
>>>>>>>> bug fixes for the following issues:
>>>>>>>>
>>>>>>>> Universal Ctags: Don't read config files; New 'ctagsoptfile'
>>>>>>>> configurati
>>>>>>>> Date:   Fri, 07 Apr 2023 13:07:07 +0200
>>>>>>>>
>>>>>>>> The workaround is still valid.
>>>>>>> I also tried with global older version, 6.6.7 and got the same
>>>>>>> result.
>>>>>>> In my understanding, 6.6.7 was released before the fix above.
>>>>>>> So, I'm suspecting that there might be another root cause...
>>>>>>>
>>>>>>> Makoto
>>>>>>>
>>>>>>> On 10/18/2023 2:39 AM, Shigio YAMAGUCHI wrote:
>>>>>>>> Hello,
>>>>>>>> I will correct my wrong statement.
>>>>>>>>
>>>>>>>>> The cause seems to be a change in Universal Ctags.
>>>>>>>> The cause of the problem was not in Universal Ctags, but in my
>>>>>>>> insufficient
>>>>>>>> bug fixes for the following issues:
>>>>>>>>
>>>>>>>> Universal Ctags: Don't read config files; New 'ctagsoptfile'
>>>>>>>> configurati
>>>>>>>> Date:   Fri, 07 Apr 2023 13:07:07 +0200
>>>>>>>>
>>>>>>>> The workaround is still valid.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Shigio
>>>>>>>>
>>>>>>>> On Wed, Oct 18, 2023 at 1:16 PM Shigio YAMAGUCHI <[email protected]>
>>>>>>>> wrote:
>>>>>>>>> Hello,
>>>>>>>>> It found out that Pygments plug-in parser does not work now.
>>>>>>>>> It's not limited to Rust. The cause seems to be a change in
>>>>>>>>> Universal Ctags.
>>>>>>>>>
>>>>>>>>> To get it running, do the following:
>>>>>>>>>
>>>>>>>>> [/usr/local/share/gtags/script/pygments_parser.py]
>>>>>>>>> 142:     self.process = subprocess.Popen([ctags_command, '-xu',
>>>>>>>>> '--filter', ...
>>>>>>>>> |
>>>>>>>>> v
>>>>>>>>> 142:     self.process = subprocess.Popen([ctags_command, '-xu',
>>>>>>>>> '--tag-relative=no', '--filter', ...
>>>>>>>>>
>>>>>>>>> Harada san, thank you for the report!
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Shigio
>>>>>>
>>>>>> --
>>>>>> Shigio YAMAGUCHI <[email protected]>
>>>>>> PGP fingerprint:
>>>>>> 26F6 31B4 3D62 4A92 7E6F  1C33 969C 3BE3 89DD A6EB
>
>