www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - d2tags - converts DMD2's JSON output to Exuberant Ctags format

reply MIURA Masahiro <echochamber gmail.com> writes:
Hi,

Being happy to see issue 3415 (broken JSON format) fixed,
I have written a utility to convert DMD2's JSON output
to Exuberent Ctags format.  This enables you to tagjump in Vim
and other editors/IDEs.  It's just 150+ lines, thanks to D2's
powerful string handling.  Enjoy!

http://github.com/Dubhead/d2tags

usage:
% dmd -Xftags.json foo.d
% d2tags tags.json > tags
May 06 2010
next sibling parent Bernard Helyer <b.helyer gmail.com> writes:
On 06/05/10 22:46, MIURA Masahiro wrote:
 Hi,
 
 Being happy to see issue 3415 (broken JSON format) fixed,
 I have written a utility to convert DMD2's JSON output
 to Exuberent Ctags format.  This enables you to tagjump in Vim
 and other editors/IDEs.  It's just 150+ lines, thanks to D2's
 powerful string handling.  Enjoy!
 
 http://github.com/Dubhead/d2tags
 
 usage:
 % dmd -Xftags.json foo.d
 % d2tags tags.json>  tags

Awesome!
May 06 2010
prev sibling next sibling parent Leandro Lucarella <llucax gmail.com> writes:
MIURA Masahiro, el  6 de mayo a las 19:46 me escribiste:
 Hi,
 
 Being happy to see issue 3415 (broken JSON format) fixed,
 I have written a utility to convert DMD2's JSON output
 to Exuberent Ctags format.  This enables you to tagjump in Vim
 and other editors/IDEs.  It's just 150+ lines, thanks to D2's
 powerful string handling.  Enjoy!
 
 http://github.com/Dubhead/d2tags
 
 usage:
 % dmd -Xftags.json foo.d
 % d2tags tags.json > tags

Great! -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- Que barbaridad, este país se va cada ves más pa' tras, más pa' tras... -- Sidharta Kiwi
May 06 2010
prev sibling next sibling parent reply Robert Clipsham <robert octarineparrot.com> writes:
On 06/05/10 11:46, MIURA Masahiro wrote:
 Hi,

 Being happy to see issue 3415 (broken JSON format) fixed,
 I have written a utility to convert DMD2's JSON output
 to Exuberent Ctags format.  This enables you to tagjump in Vim
 and other editors/IDEs.  It's just 150+ lines, thanks to D2's
 powerful string handling.  Enjoy!

 http://github.com/Dubhead/d2tags

 usage:
 % dmd -Xftags.json foo.d
 % d2tags tags.json>  tags

I love it! I don't suppose you have a guide for how to get it set up and working in vim do you? I've never managed to get ctags working, even with C/C++ :/
May 06 2010
parent MIURA Masahiro <echochamber gmail.com> writes:
On 05/07/2010 01:36 AM, Robert Clipsham wrote:
 I love it! I don't suppose you have a guide for how to get it set up and
 working in vim do you? I've never managed to get ctags working, even
 with C/C++ :/

The only tag-related configuration in my Vim setup is: set tags=./tags; in ~/.vimrc (Note the semicolon: it makes Vim look for tags file upward to the root directory).
May 06 2010
prev sibling next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
MIURA Masahiro wrote:
 Hi,
 
 Being happy to see issue 3415 (broken JSON format) fixed,
 I have written a utility to convert DMD2's JSON output
 to Exuberent Ctags format.  This enables you to tagjump in Vim
 and other editors/IDEs.  It's just 150+ lines, thanks to D2's
 powerful string handling.  Enjoy!
 
 http://github.com/Dubhead/d2tags
 
 usage:
 % dmd -Xftags.json foo.d
 % d2tags tags.json > tags

Very useful, and a beautiful example of D scripting. I wonder if this is of enough general utility to warrant inclusion within the D distribution, along with rdmd. Thoughts? One small suggestion, Masahiro: you may want to replace the file reading loop in main() with simply std.file.readText(args[1]). Andrei
May 06 2010
next sibling parent reply Pelle <pelle.mansson gmail.com> writes:
On 05/06/2010 06:48 PM, Andrei Alexandrescu wrote:
 I wonder if this is of enough general utility to warrant inclusion
 within the D distribution, along with rdmd. Thoughts?

Yes please, rdmd --tags would be great.
May 06 2010
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Pelle wrote:
 On 05/06/2010 06:48 PM, Andrei Alexandrescu wrote:
 I wonder if this is of enough general utility to warrant inclusion
 within the D distribution, along with rdmd. Thoughts?

Yes please, rdmd --tags would be great.

I was thinking of including the utility as a separate program. Andrei
May 06 2010
prev sibling next sibling parent "Masahiro Nakagawa" <repeatedly gmail.com> writes:
On Fri, 07 May 2010 01:48:59 +0900, Andrei Alexandrescu
<SeeWebsiteForEmail erdani.org> wrote:

 MIURA Masahiro wrote:
 Hi,

 Being happy to see issue 3415 (broken JSON format) fixed,
 I have written a utility to convert DMD2's JSON output
 to Exuberent Ctags format.  This enables you to tagjump in Vim
 and other editors/IDEs.  It's just 150+ lines, thanks to D2's
 powerful string handling.  Enjoy!

 http://github.com/Dubhead/d2tags

 usage:
 % dmd -Xftags.json foo.d
 % d2tags tags.json > tags

Very useful, and a beautiful example of D scripting. I wonder if this is of enough general utility to warrant inclusion within the D distribution, along with rdmd. Thoughts?

vote++
May 06 2010
prev sibling next sibling parent reply Lutger <lutger.blijdestijn gmail.com> writes:
Andrei Alexandrescu wrote:

 MIURA Masahiro wrote:
 Hi,
 
 Being happy to see issue 3415 (broken JSON format) fixed,
 I have written a utility to convert DMD2's JSON output
 to Exuberent Ctags format.  This enables you to tagjump in Vim
 and other editors/IDEs.  It's just 150+ lines, thanks to D2's
 powerful string handling.  Enjoy!
 
 http://github.com/Dubhead/d2tags
 
 usage:
 % dmd -Xftags.json foo.d
 % d2tags tags.json > tags

Very useful, and a beautiful example of D scripting. I wonder if this is of enough general utility to warrant inclusion within the D distribution, along with rdmd. Thoughts?

Yes it's very useful. How about also including the source in the examples directory?
May 06 2010
parent Bernard Helyer <b.helyer gmail.com> writes:
On 07/05/10 06:30, Lutger wrote:
 Yes it's very useful. How about also including the source in the examples
 directory?

That's a good idea, seeing as most of the examples are either for Windows, or outdated.
May 06 2010
prev sibling parent reply MIURA Masahiro <echochamber gmail.com> writes:
On 05/07/2010 01:48 AM, Andrei Alexandrescu wrote:
 I wonder if this is of enough general utility to warrant inclusion
 within the D distribution, along with rdmd. Thoughts?

That's my pleasure, actually!
 One small suggestion, Masahiro: you may want to replace the file reading
 loop in main() with simply std.file.readText(args[1]).

Done, thank you for the advice. I'm considering an enhancement: "d2tags <DIRECTORY>" reads all JSON files in the directory. However I'm not sure if it should recurse into subdirectories.
May 06 2010
parent reply =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
MIURA Masahiro wrote:

 I'm considering an enhancement:  "d2tags <DIRECTORY>" reads
 all JSON files in the directory.  However I'm not sure if it
 should recurse into subdirectories.

I think simpler is better. There are already tools like find on all Linux shells that could do the recursion. Ali
May 06 2010
parent "Nick Sabalausky" <a a.a> writes:
"Ali ehreli" <acehreli yahoo.com> wrote in message 
news:hs0332$cdc$1 digitalmars.com...
 MIURA Masahiro wrote:

 I'm considering an enhancement:  "d2tags <DIRECTORY>" reads
 all JSON files in the directory.  However I'm not sure if it
 should recurse into subdirectories.

I think simpler is better. There are already tools like find on all Linux shells that could do the recursion.

I'd say "d2tags <DIRECTORY>" is a lot simpler than figuring out Linux's find and combining it with d2tags.
May 06 2010
prev sibling next sibling parent Leandro Lucarella <llucax gmail.com> writes:
Andrei Alexandrescu, el  6 de mayo a las 09:48 me escribiste:
 MIURA Masahiro wrote:
 Hi,
 
 Being happy to see issue 3415 (broken JSON format) fixed,
 I have written a utility to convert DMD2's JSON output
 to Exuberent Ctags format.  This enables you to tagjump in Vim
 and other editors/IDEs.  It's just 150+ lines, thanks to D2's
 powerful string handling.  Enjoy!
 
 http://github.com/Dubhead/d2tags
 
 usage:
 % dmd -Xftags.json foo.d
 % d2tags tags.json > tags

Very useful, and a beautiful example of D scripting. I wonder if this is of enough general utility to warrant inclusion within the D distribution, along with rdmd. Thoughts?

I think it might be better to add support to the common tools, like exuberant-ctags[1], but having it as part of rdmd or whatever could be nice too. [1] http://ctags.sourceforge.net/ -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- A lo que Peperino respondióles: aquel que tenga sabañones que se los moje, aquel que padece calvicie no padece un osito, no es bueno comer lechón en día de gastritis, no mezcleis el vino con la sandía, sacad la basura después de las ocho, en caso de emergencia rompa el vidrio con el martillo, a cien metros desvio por Pavón. -- Peperino Pómoro
May 06 2010
prev sibling parent Leandro Lucarella <llucax gmail.com> writes:
Nick Sabalausky, el  7 de mayo a las 00:13 me escribiste:
 "Ali ehreli" <acehreli yahoo.com> wrote in message 
 news:hs0332$cdc$1 digitalmars.com...
 MIURA Masahiro wrote:

 I'm considering an enhancement:  "d2tags <DIRECTORY>" reads
 all JSON files in the directory.  However I'm not sure if it
 should recurse into subdirectories.

I think simpler is better. There are already tools like find on all Linux shells that could do the recursion.

I'd say "d2tags <DIRECTORY>" is a lot simpler than figuring out Linux's find and combining it with d2tags.

Add a -R option, this way it will work just like exuberant-ctags =) -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- Please could you stop the noise, I'm trying to get some rest From all the unborn chicken voices in my head What's that...? (I may be paranoid, but not an android)
May 07 2010