Re: How can I convert from Universal Ctags?

Shigio YAMAGUCHI <[email protected]> Mon, 9 Sep 2024 08:00:01 +0900
Newsgroups gmane.comp.gnu.global.general
Message-ID <CADJmJYoLNVdg762uYqWcp6H9+C29Vgz5+rxHkderJz9-BOnyjg@mail.gmail.com>
Hello,
Please see the second EXAMPLES section of gtags(1).
However, you must set ctagscom variable to uctags path like this:

[/usr/local/share/gtags/gtags.conf]
+----------------------------------------------------------------
|...
|universal-ctags|setting to use Universal Ctags plug-in parser:\
|        :tc=3Dcommon:\
|        :ctagscom=3D/usr/local/bin/u-ctags:\              <=3D=3D=3D Pleas=
e
set uctags path.
|        :ctagslib=3D$libdir/gtags/universal-ctags.la:\
|...

$ GTAGSCONF=3D/usr/local/share/gtags/gtags.conf
$ GTAGSLABEL=3Duniversal-ctags
$ gtags
$ global -x '.*'
Bar                 3 Bar.cs           public class Bar : IBar
Common.Services     1 Bar.cs           namespace Common.Services
Common.Services     4 IBar.cs          namespace Common.Services
Common.Services     1 Program.cs       namespace Common.Services
Hukarz              5 Bar.cs           public void Hukarz()
Hukarz              8 IBar.cs          public void Hukarz();
IBar                6 IBar.cs          interface IBar
Main                5 Program.cs       public static void Main()
Tester              3 Program.cs       public class Tester
$ _

Good luck!

On Sat, Sep 7, 2024 at 10:20=E2=80=AFPM Esben Stien <[email protected]>=
 wrote:
>
>
> I'm trying to get C# tags to work and I'm not getting anything to work,
> so I have to start from the beginning;)
>
> I have Universal Ctags installed as u-ctags
>
> ```
> $ u-ctags --version
> Universal Ctags 6.1.0, Copyright (C) 2015-2023 Universal Ctags Team
> Universal Ctags is derived from Exuberant Ctags.
> Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
>   URL: https://ctags.io/
>   Output version: 0.0
>   Optional compiled features: +wildcards, +regex, +iconv, +option-directo=
ry, +xpath, +json, +interactive, +sandbox, +yaml, +packcc, +optscript, +pcr=
e2
> ```
>
> I have C# source files.
>
> Program.cs
>
> ```
> namespace Common.Services
> {
>   public class Tester
>   {
>     public static void Main()
>     {
>       IBar Bar =3D new Bar();
>       Bar.Hukarz();
>     }
>   }
> }
> ```
>
> IBar.cs
> ```
> using System;
> using System.Collections.Generic;
>
> namespace Common.Services
> {
>     interface IBar
>     {
>         public void Hukarz();
>     }
> }
> ```
>
> Bar.cs
> ```
> namespace Common.Services
> {
>   public class Bar : IBar
>   {
>     public void Hukarz()
>     {
>         System.Console.WriteLine("ehlo");
>     }
>   }
> }
> ```
>
> I create the tags file, as such
>
> ```
> u-ctags -R
> ```
>
> The tags file looks like this.
>
> ```
> !_TAG_EXTRA_DESCRIPTION anonymous       /Include tags for non-named objec=
ts like lambda/
> !_TAG_EXTRA_DESCRIPTION fileScope       /Include tags of file scope/
> !_TAG_EXTRA_DESCRIPTION pseudo  /Include pseudo tags/
> !_TAG_EXTRA_DESCRIPTION subparser       /Include tags generated by subpar=
sers/
> !_TAG_FIELD_DESCRIPTION epoch   /the last modified time of the input file=
 (only for F\/file kind tag)/
> !_TAG_FIELD_DESCRIPTION file    /File-restricted scoping/
> !_TAG_FIELD_DESCRIPTION input   /input file/
> !_TAG_FIELD_DESCRIPTION name    /tag name/
> !_TAG_FIELD_DESCRIPTION pattern /pattern/
> !_TAG_FIELD_DESCRIPTION typeref /Type and name of a variable or typedef/
> !_TAG_FILE_FORMAT       2       /extended format; --format=3D1 will not a=
ppend ;" to lines/
> !_TAG_FILE_SORTED       1       /0=3Dunsorted, 1=3Dsorted, 2=3Dfoldcase/
> !_TAG_KIND_DESCRIPTION!C#       E,event /events/
> !_TAG_KIND_DESCRIPTION!C#       c,class /classes/
> !_TAG_KIND_DESCRIPTION!C#       d,macro /macro definitions/
> !_TAG_KIND_DESCRIPTION!C#       e,enumerator    /enumerators (values insi=
de an enumeration)/
> !_TAG_KIND_DESCRIPTION!C#       f,field /fields/
> !_TAG_KIND_DESCRIPTION!C#       g,enum  /enumeration names/
> !_TAG_KIND_DESCRIPTION!C#       i,interface     /interfaces/
> !_TAG_KIND_DESCRIPTION!C#       m,method        /methods/
> !_TAG_KIND_DESCRIPTION!C#       n,namespace     /namespaces/
> !_TAG_KIND_DESCRIPTION!C#       p,property      /properties/
> !_TAG_KIND_DESCRIPTION!C#       s,struct        /structure names/
> !_TAG_KIND_DESCRIPTION!C#       t,typedef       /typedefs/
> !_TAG_OUTPUT_EXCMD      mixed   /number, pattern, mixed, or combineV2/
> !_TAG_OUTPUT_FILESEP    slash   /slash or backslash/
> !_TAG_OUTPUT_MODE       u-ctags /u-ctags or e-ctags/
> !_TAG_OUTPUT_VERSION    0.0     /current.age/
> !_TAG_PARSER_VERSION!C# 0.0     /current.age/
> !_TAG_PATTERN_LENGTH_LIMIT      96      /0 for no limit/
> !_TAG_PROC_CWD  /home/b0ef/proj/2024-08-12.debug-csharp-interface-tags/ /=
/
> !_TAG_PROGRAM_AUTHOR    Universal Ctags Team    //
> !_TAG_PROGRAM_NAME      Universal Ctags /Derived from Exuberant Ctags/
> !_TAG_PROGRAM_URL       https://ctags.io/       /official site/
> !_TAG_PROGRAM_VERSION   6.1.0   //
> Bar     Bar.cs  /^  public class Bar : IBar$/;" c       namespace:Common.=
Services
> Common.Services Bar.cs  /^namespace Common.Services$/;" n
> Common.Services IBar.cs /^namespace Common.Services$/;" n
> Common.Services Program.cs      /^namespace Common.Services$/;" n
> Hukarz  Bar.cs  /^    public void Hukarz()$/;"  m       class:Common.Serv=
ices.Bar
> Hukarz  IBar.cs /^        public void Hukarz();$/;"     m       interface=
:Common.Services.IBar
> IBar    IBar.cs /^    interface IBar$/;"        i       namespace:Common.=
Services
> Main    Program.cs      /^    public static void Main()$/;"     m       c=
lass:Common.Services.Tester
> Tester  Program.cs      /^  public class Tester$/;"     c       namespace=
:Common.Services
>
> ```
>
> If I now convert this to GNU Global, as such
> ```
> gtags --gtagslabel=3Dctags -f tags
> ```
>
> , which outputs:
>
> ```
> Warning: '!_TAG_EXTRA_DESCRIPTIONanonymous        /Include tags for non-n=
amed objects like lambda/' not found. ignored.
> Warning: '!_TAG_EXTRA_DESCRIPTIONfileScope        /Include tags of file s=
cope/' not found. ignored.
> Warning: '!_TAG_EXTRA_DESCRIPTIONpseudo   /Include pseudo tags/' not foun=
d. ignored.
> Warning: '!_TAG_EXTRA_DESCRIPTIONsubparser        /Include tags generated=
 by subparsers/' not found. ignored.
> Warning: '!_TAG_FIELD_DESCRIPTIONepoch    /the last modified time of the =
input file (only for F\/file kind tag)/' not found. ignored.
> Warning: '!_TAG_FIELD_DESCRIPTIONfile     /File-restricted scoping/' not =
found. ignored.
> Warning: '!_TAG_FIELD_DESCRIPTIONinput    /input file/' not found. ignore=
d.
> Warning: '!_TAG_FIELD_DESCRIPTIONname     /tag name/' not found. ignored.
> Warning: '!_TAG_FIELD_DESCRIPTIONpattern  /pattern/' not found. ignored.
> Warning: '!_TAG_FIELD_DESCRIPTIONtyperef  /Type and name of a variable or=
 typedef/' not found. ignored.
> Warning: '!_TAG_FILE_FORMAT     2/extended format; --format=3D1 will not =
append ;" to lines/' not found. ignored.
> Warning: '!_TAG_FILE_SORTED     1/0=3Dunsorted, 1=3Dsorted, 2=3Dfoldcase/=
' not found. ignored.
> Warning: '!_TAG_KIND_DESCRIPTION!C#       E,event /events/' not found. ig=
nored.
> Warning: '!_TAG_KIND_DESCRIPTION!C#       c,class /classes/' not found. i=
gnored.
> Warning: '!_TAG_KIND_DESCRIPTION!C#       d,macro /macro definitions/' no=
t found. ignored.
> Warning: '!_TAG_KIND_DESCRIPTION!C#       e,enumerator    /enumerators (v=
alues inside an enumeration)/' not found. ignored.
> Warning: '!_TAG_KIND_DESCRIPTION!C#       f,field /fields/' not found. ig=
nored.
> Warning: '!_TAG_KIND_DESCRIPTION!C#       g,enum  /enumeration names/' no=
t found. ignored.
> Warning: '!_TAG_KIND_DESCRIPTION!C#       i,interface     /interfaces/' n=
ot found. ignored.
> Warning: '!_TAG_KIND_DESCRIPTION!C#       m,method        /methods/' not =
found. ignored.
> Warning: '!_TAG_KIND_DESCRIPTION!C#       n,namespace     /namespaces/' n=
ot found. ignored.
> Warning: '!_TAG_KIND_DESCRIPTION!C#       p,property      /properties/' n=
ot found. ignored.
> Warning: '!_TAG_KIND_DESCRIPTION!C#       s,struct        /structure name=
s/' not found. ignored.
> Warning: '!_TAG_KIND_DESCRIPTION!C#       t,typedef       /typedefs/' not=
 found. ignored.
> Warning: '!_TAG_OUTPUT_EXCMD    mixed     /number, pattern, mixed, or com=
bineV2/' not found. ignored.
> Warning: '!_TAG_OUTPUT_FILESEP  slash     /slash or backslash/' not found=
. ignored.
> Warning: '!_TAG_OUTPUT_MODE     u-ctags   /u-ctags or e-ctags/' not found=
. ignored.
> Warning: '!_TAG_OUTPUT_VERSION  0.0       /current.age/' not found. ignor=
ed.
> Warning: '!_TAG_PARSER_VERSION!C#0.0      /current.age/' not found. ignor=
ed.
> Warning: '!_TAG_PATTERN_LENGTH_LIMIT      96      /0 for no limit/' not f=
ound. ignored.
> Warning: '!_TAG_PROC_CWD        /home/b0ef/proj/2024-08-12.debug-csharp-i=
nterface-tags/     //' not found. ignored.
> Warning: '!_TAG_PROGRAM_AUTHOR  Universal Ctags Team      //' not found. =
ignored.
> Warning: '!_TAG_PROGRAM_NAME    Universal Ctags   /Derived from Exuberant=
 Ctags/' not found. ignored.
> Warning: '!_TAG_PROGRAM_URL     https://ctags.io/ /official site/' not fo=
und. ignored.
> Warning: '!_TAG_PROGRAM_VERSION 6.1.0     //' not found. ignored.
> Warning: 'Bar   Bar.cs  /^  public class Bar : IBar$/;"   c       namespa=
ce:Common.Services' not found. ignored.
> Warning: 'Common.Services       Bar.cs    /^namespace Common.Services$/;"=
   n' not found. ignored.
> Warning: 'Common.Services       IBar.cs   /^namespace Common.Services$/;"=
   n' not found. ignored.
> Warning: 'Common.Services       Program.cs        /^namespace Common.Serv=
ices$/;"   n' not found. ignored.
> Warning: 'Hukarz        Bar.cs  /^    public void Hukarz()$/;"    mclass:=
Common.Services.Bar' not found. ignored.
> Warning: 'Hukarz        IBar.cs /^        public void Hukarz();$/;"m
> interface:Common.Services.IBar' not found. ignored.
> Warning: 'IBar  IBar.cs /^    interface IBar$/;"  i       namespace:Commo=
n.Services' not found. ignored.
> Warning: 'Main  Program.cs      /^    public static void Main()$/;"m
> class:Common.Services.Tester' not found. ignored.
> Warning: 'Tester        Program.cs
> /^  public class Tester$/;"     cnamespace:Common.Services' not found. ig=
nored.
>
> ```
>
> The resulting three G* files don't contain any symbols.
>
> Any pointers as to what's happening here?;)
>
>
> --
> Esben Stien is b0ef@e     s      a
>          http://www. s     t    n m
>           irc://irc.  b  -  i  .   e/%23contact
>            sip:b0ef@   e     e
>            jid:b0ef@    n     n
>


--=20
Shigio YAMAGUCHI <[email protected]>
PGP fingerprint:
26F6 31B4 3D62 4A92 7E6F  1C33 969C 3BE3 89DD A6EB