Personal tools

Tags

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
 
(Haskell tag generators: add hothasktags)
 
(12 intermediate revisions by 8 users not shown)
Line 1: Line 1:
= Tags =
+
[[Category:Development tools]]
  +
== Introduction ==
  +
  +
"Tags" are a listing of source code definitions in a group of files, together with their precise location, often used by text editors to quickly jump around in a program. For example, they allow you in a editor that supports tags to jump to the definition of a function when you come across a use of that function. <tt>ctags</tt> (for C) was the first tag-generation program. See the [http://en.wikipedia.org/wiki/Ctags wikipedia article] for more information.
   
 
There are currently a number of different ways to generate tags with
 
There are currently a number of different ways to generate tags with
 
Haskell.
 
Haskell.
   
This page should be used to collect information on them, including information on how to use tags with common editors and what benefits they can give you.
+
== Tags Formats ==
  +
  +
Tag files can be produced in a number of different formats supported by different editors. The two most common formats are 'ctags', which is supported by Vim and others, and 'etags', which is supported by Emacs. Note that the default names for the file in ctags format and the file in etags format are 'tags' and 'TAGS' respectively
  +
  +
== Haskell tag generators ==
   
= Haskell tag generators =
+
* [http://www.haskell.org/ghc GHC]: Can generate tag files from GHCi. Use either the ':ctags' or ':etags' commands to produce a tags file for the currently loaded modules.
   
Chris Ryder and Simon Thompson give a tag generator's source in
+
:For example:
[http://www.cs.kent.ac.uk/pubs/2005/2266/content.pdf a paper]
+
:<tt>echo ":ctags" | ghci -v0 Main.hs</tt>
  +
:<tt>echo ":etags" | ghci -v0 Main.hs</tt>
   
Norman Ramsey and Kathleen Fisher's partial hasktags implementation
+
* [http://hackage.haskell.org/package/hasktags Hasktags]: Can produce either a ctags or etags compatible tag file.
using the GHC API is [http://darcs.haskell.org/ghctags/ in darcs].
+
* [http://kingfisher.nfshost.com/sw/gasbag/ Gasbag]: An apparently improved version of Hasktags.
There's also a [http://hackage.haskell.org/trac/ghc/ticket/946 GHC trac task] relating to it.
+
* [http://hackage.haskell.org/package/hothasktags hothasktags]: uses haskell-src-exts instead of haskell-src, and knows about import lists and qualified imports
   
<tt>echo ":ctags" | ghci -v0 Main.hs</tt>
 
   
<tt>echo ":etags" | ghci -v0 Main.hs</tt>
+
You can also find the source code for a tag generator in Chris Ryder and Simon Thompson [http://www.cs.kent.ac.uk/pubs/2005/2266/content.pdf paper] on porting the Haskell Refactoring tool, HaRe, to the GHC API.
   
utils/hasktags from GHC.
+
== More Information ==
   
= Random other bits =
+
=== Vim ===
  +
* [http://vimdoc.sourceforge.net/htmldoc/usr_29.html#29.1 Using tags in Vim]
  +
* [http://vimdoc.sourceforge.net/htmldoc/tagsrch.html#tags :help tags]
  +
* [http://vimdoc.sourceforge.net/htmldoc/insert.html#ins-completion insert-mode tag completion] (ctrl-x ctrl-])
  +
*[http://vimdoc.sourceforge.net/htmldoc/windows.html#CursorHold-example :help cursorhold-example]
  +
* [http://vim-taglist.sourceforge.net/ Vim plugin to view all tags in a window]
  +
* [http://majutsushi.github.com/tagbar/ Another plugin]; newer's not always better, but this is still actively maintained as of 2012
   
http://vim-taglist.sourceforge.net/
+
=== Others ===
   
<pre>
+
* [http://www.nedit.org/help/tags.php#Finding_Declarations_(ctags) NEdit documentation for using tags]
vim
+
* Chapter 14 of the BBEdit manual covers using tags
:help tags-file-format
 
:help cursorhold-example
 
</pre>
 

Latest revision as of 16:51, 16 October 2013

Contents

[edit] 1 Introduction

"Tags" are a listing of source code definitions in a group of files, together with their precise location, often used by text editors to quickly jump around in a program. For example, they allow you in a editor that supports tags to jump to the definition of a function when you come across a use of that function. ctags (for C) was the first tag-generation program. See the wikipedia article for more information.

There are currently a number of different ways to generate tags with Haskell.

[edit] 2 Tags Formats

Tag files can be produced in a number of different formats supported by different editors. The two most common formats are 'ctags', which is supported by Vim and others, and 'etags', which is supported by Emacs. Note that the default names for the file in ctags format and the file in etags format are 'tags' and 'TAGS' respectively

[edit] 3 Haskell tag generators

  • GHC: Can generate tag files from GHCi. Use either the ':ctags' or ':etags' commands to produce a tags file for the currently loaded modules.
For example:
echo ":ctags" | ghci -v0 Main.hs
echo ":etags" | ghci -v0 Main.hs
  • Hasktags: Can produce either a ctags or etags compatible tag file.
  • Gasbag: An apparently improved version of Hasktags.
  • hothasktags: uses haskell-src-exts instead of haskell-src, and knows about import lists and qualified imports


You can also find the source code for a tag generator in Chris Ryder and Simon Thompson paper on porting the Haskell Refactoring tool, HaRe, to the GHC API.

[edit] 4 More Information

[edit] 4.1 Vim

[edit] 4.2 Others