|
From: | Shigio YAMAGUCHI |
Subject: | Re: ctags as a source for gtags |
Date: | Tue, 21 Jan 2014 18:43:36 +0900 |
Hi,the man page tells me that I can use the -f option to supply a list of files, rather than gtags scanning all files:
-f, --file file
Browse through all source files whose names are listed in file. The argument file can be set to '-' to accept a list
of files from the standard input. File names must be separated by newline.But if I use that option, gtags has trouble using the ctags parser as quoted in my previous email:
➜ xtest gtags -v --debug -f Message.scala
[Tue Jan 21 22:24:48 NZDT 2014] Gtags started.Using 'Message.scala' as a file list.
Using config file '/usr/local/share/gtags/gtags.conf'.
Using plug-in parser.
[Tue Jan 21 22:24:48 NZDT 2014] Creating 'GTAGS' and 'GRTAGS'.[Tue Jan 21 22:24:48 NZDT 2014] Done.
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.
➜ xtest global Message
➜ xtestPlease compare this to:
➜ xtest gtags -v --debug
[Tue Jan 21 22:25:20 NZDT 2014] Gtags started.[Tue Jan 21 22:25:20 NZDT 2014] Creating 'GTAGS' and 'GRTAGS'.
Using config file '/usr/local/share/gtags/gtags.conf'.
Using plug-in parser.[Tue Jan 21 22:25:20 NZDT 2014] Done.
[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|
➜ xtest global Message
Message.scala
➜ xtestOn Tue, Jan 21, 2014 at 10:21 PM, Shigio YAMAGUCHI <address@hidden> wrote:
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 gtags2014/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 './Message.scala' as a file list.
Using config file '/usr/local/share/gtags/gtags.conf'.
Using plug-in parser.
[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: ' def testMe = 23' not found. ignored.
Warning: 'trait Message {' 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.[Tue Jan 21 22:11:03 NZDT 2014] Creating 'GTAGS' and 'GRTAGS'.
Using config file '/usr/local/share/gtags/gtags.conf'.
Using plug-in parser.
[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 --debug2014/1/21 Felix Geller <address@hidden>
FelixAgain, thanks!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.scalaMessage 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/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?
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:\
On Tue, Jan 21, 2014 at 8:11 PM, Shigio YAMAGUCHI <address@hidden> wrote:
Hi,> gtags -vv -f x/src/main/scala/Message.scalaArguments are unnecessary to gtags command.Please do like follows.$ gtags -vBy 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:[... Lots of warnings ...]
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'.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=ctagsAnd there is a ctags label for excuberant tags in my /usr/local/share/gtags/gtags.confWhat 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
[Prev in Thread] | Current Thread | [Next in Thread] |