|(3 intermediate revisions by 3 users not shown)|
Revision as of 17:27, 6 August 2012
"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.
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
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.
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.
4 More Information
- Using tags in Vim
- :help tags
- insert-mode tag completion (ctrl-x ctrl-])
- :help cursorhold-example
- Vim plugin to view all tags in a window
- Another plugin; newer's not always better, but this is still actively maintained as of 2012
- NEdit documentation for using tags
- Chapter 14 of the BBEdit manual covers using tags