help-global
[Top][All Lists]
Advanced

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

Re: ctags as a source for gtags


From: Shigio YAMAGUCHI
Subject: Re: ctags as a source for gtags
Date: Tue, 21 Jan 2014 18:21:41 +0900

Hi,
It seems no problem.

But I'd like to use the -f option for incremental updates. Do you see a way around this?

Would you please try this command line ?

$ man gtags



2014/1/21 Felix Geller <address@hidden>
Hi!

Looks like only the -f part causes trouble:

➜  xtest  gtags -v --debug -f `find . -name "Message.scala"`
[Tue Jan 21 22:10:44 NZDT 2014] Gtags started.

 Using config file '/usr/local/share/gtags/gtags.conf'.
 Using plug-in parser.
 Using './Message.scala' as a file list.
[Tue Jan 21 22:10:44 NZDT 2014] Creating 'GTAGS' and 'GRTAGS'.
Warning: 'package test' not found. ignored.
Warning: 'import scala.concurrent._' not found. ignored.

Warning: 'trait Message {' not found. ignored.
Warning: '  def testMe = 23' not found. ignored.
Warning: '}' not found. ignored.
[Tue Jan 21 22:10:44 NZDT 2014] Done.

If I run gtags for everything it runs fine:

➜  xtest  gtags -v --debug                                 
[Tue Jan 21 22:11:03 NZDT 2014] Gtags started.

 Using config file '/usr/local/share/gtags/gtags.conf'.
 Using plug-in parser.
[Tue Jan 21 22:11:03 NZDT 2014] Creating 'GTAGS' and 'GRTAGS'.
 [1] extracting tags of Message.scala
File './Message.scala' is handled as follows:
    suffix:   |.scala|
    language: |Scala|
    parser:   |parser|
    library:  |/usr/local/Cellar/global/6.2.9/lib/gtags/exuberant-ctags.la|
[Tue Jan 21 22:11:03 NZDT 2014] Done.


But I'd like to use the -f option for incremental updates. Do you see a way around this?



On Tue, Jan 21, 2014 at 10:01 PM, Shigio YAMAGUCHI <address@hidden> wrote:
Hi,
Could you show me the output of  the following command line?

$ gtags -v --debug


2014/1/21 Felix Geller <address@hidden>
Hi!

Thank you for your reply! I already have a ctags configuration for ctags, cf. the output of the ctags command I posted:

$ ctags -x x/src/main/scala/Message.scala                   
Message       traits      220 ./x/src/main/scala/Message.scala trait Message {
(... omitted a couple of lines ...)

This is my ctags config:

--langdef=Scala
--langmap=Scala:.scala

--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\4/c,classes/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*object[ \t]+([a-zA-Z0-9_]+)/\4/c,objects/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*case class[ \t]+([a-zA-Z0-9_]+)/\4/c,classes/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*case object[ \t]+([a-zA-Z0-9_]+)/\4/c,objects/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*trait[ \t]+([a-zA-Z0-9_]+)/\4/t,traits/
--regex-scala=/^[ \t]*type[ \t]+([a-zA-Z0-9_]+)/\1/T,types/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*def[ \t]+([a-zA-Z0-9_]+)/\3/m,methods/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*val[ \t]+([a-zA-Z0-9_]+)/\3/l,constants/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*var[ \t]+([a-zA-Z0-9_]+)/\3/l,variables/
--regex-scala=/^[ \t]*package[ \t]+([a-zA-Z0-9_.]+)/\1/p,packages/

And I have the following lines in my gtags.conf (I'm on Mac OS X, installed global via homebrew):

    :langmap=Scala\:.scala:\
    :gtags_parser=Scala\:/usr/local/Cellar/global/6.2.9/lib/gtags/exuberant-ctags.la:\

I think gtags isn't picking up the ctags output, which might not contained required fields as Scala is a custom language for ctags? Do you know whether the ctags output is ok? As far as I understand the parser, it invokes `ctags -x` on each file, right?

Again, thanks!

Felix




On Tue, Jan 21, 2014 at 8:11 PM, Shigio YAMAGUCHI <address@hidden> wrote:
Hi,
> gtags -vv -f x/src/main/scala/Message.scala

Arguments are unnecessary to gtags command.
Please do like follows.

$ gtags -v

By the way, it seems that ctags does not support Scala language.
So, you need to do the following two at least.

1. write a Scala parser for ctags.
2. write mapping definitions for Scala to 'gtags.conf'.

I don't know about 1.
The 2. is simple. Just adding the following to 'gtags.conf'.

[/usr/local/share/gtags/gtags.conf]
...
:langmap=Scala\:.scala:\
:gtags_parser=Scala\:/usr/local/lib/gtags/exuberant-ctags.la:\

Good luck.



2014/1/21 Felix Geller <address@hidden>
Hi,

I'm trying to use ctags as a source for gtags for scala files, but am not getting any tags in gtags while ctags finds them. For example:

gtags only prints a warning:

gtags -vv -f x/src/main/scala/Message.scala
Tue Jan 21 11:31:41 NZDT 2014] Gtags started.
 Using config file '/usr/local/share/gtags/gtags.conf'.
 Using plug-in parser.
 Using '.x/src/main/scala/Message.scala' as a file list.
[Tue Jan 21 11:31:41 NZDT 2014] Creating 'GTAGS' and 'GRTAGS'.
[... Lots of warnings ...]
Warning: 'trait Message {' not found. ignored.

But ctags is happily identifying the name:

ctags -x x/src/main/scala/Message.scala                   
Message       traits      220 ./x/src/main/scala/Message.scala trait Message {

Looking through the archives I found that missing GTAGSCONF or GTAGSLABEL might be a problem, but they are set:

set | ag GTA 
GTAGSCONF=/usr/local/share/gtags/gtags.conf
GTAGSLABEL=ctags

And there is a ctags label for excuberant tags in my /usr/local/share/gtags/gtags.conf

What might be missing? I would appreciate any help to debug this :)

Thanks!

Felix

_______________________________________________
Help-global mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-global




--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3




--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3




--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3

reply via email to

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