ghc-tags: Utility for generating ctags and etags with GHC API.

[ development, mpl, program ] [ Propose Tags ] [ Report a vulnerability ]

Utility for generating etags (Emacs) and ctags (Vim and other editors) with GHC API for efficient project navigation.


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
ghc-lib

Use ghc-lib even when compiling with compatible GHC version.

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9
Change log CHANGELOG.md
Dependencies aeson (>=2.0.0.0), async (>=2.2.5), attoparsec, base (>=4.18 && <4.21), bytestring, containers, deepseq, directory, filepath, ghc, ghc-boot, ghc-lib (>=9.10 && <9.11), ghc-paths, optparse-applicative, process, stm, temporary, text, time, vector, yaml [details]
Tested with ghc ==9.6.5 || ==9.8.2 || ==9.10.1
License MPL-2.0
Copyright Andrzej Rybczak
Author Andrzej Rybczak
Maintainer andrzej@rybczak.net
Revised Revision 1 made by arybczak at 2024-08-08T15:49:25Z
Category Development
Home page https://github.com/arybczak/ghc-tags
Bug tracker https://github.com/arybczak/ghc-tags/issues
Source repo head: git clone https://github.com/arybczak/ghc-tags
Uploaded by arybczak at 2024-06-06T22:03:57Z
Distributions NixOS:1.7
Executables ghc-tags
Downloads 1189 total (32 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2024-06-06 [all 1 reports]

Readme for ghc-tags-1.9

[back to package description]

ghc-tags

Build Status Hackage

A command line tool that generates etags (Emacs) and ctags (Vim, VSCode with ctagsx etc.) for efficient code navigation (jump to definition).

Main features:

  • Leverages GHC API to obtain accurate information.
  • Uses multiple CPU cores when processing source files.
  • Supports fast incremental updates.

Supported file extensions:

  • .hs
  • .hs-boot
  • .lhs
  • .x (requires alex)
  • .hsc (requires hsc2hs)

Usage

For simple projects, i.e. the ones that don't use C pre-processor in non-trivial ways nor include any C sources it should be enough to execute ghc-tags -e (for etags) or ghc-tags -c (for ctags) in the root directory of the project.

For more complicated projects you need to create the configuration file (ghc-tags.yaml by default). It can contain the following keys:

  • source_paths - a list of paths for ghc-tags to process. Directories are traversed recursively.
  • exclude_paths - a list of paths for ghc-tags to exclude from processing.
  • language - the flavour of Haskell, either Haskell98 or Haskell2010.
  • extensions - a list of GHC language extensions to enable when parsing. Note that GHC needs much less extensions for parsing alone, so you should almost never need to override this.
  • cpp_includes - include paths for the C pre-processor.
  • cpp_options - other options for the C pre-processor, e.g. defines (usually undefined MIN_VERSION_x macros will go here).

If any of these keys is not specified, an appropriate default value will be picked instead. You can inspect the defaults by executing ghc-tags --default.

Note: it is possible to specify multiple project configurations in the configuration file by separating them with ---. For example, here is a configuration for GHC on Linux (compiler, utils and base):

source_paths:
- compiler

cpp_includes:
- _build/stage1/compiler/build
- compiler
- includes/dist-derivedconstants/header

---

source_paths:
- libraries/base

exclude_paths:
- libraries/base/GHC/Conc/POSIX/Const.hsc
- libraries/base/GHC/Event/Windows.hsc
- libraries/base/GHC/Event/Windows/ConsoleEvent.hsc
- libraries/base/GHC/Event/Windows/FFI.hsc
- libraries/base/GHC/IO/Windows/Handle.hsc
- libraries/base/System/CPUTime/Windows.hsc
- libraries/base/tests

cpp_includes:
- _build/stage1/libraries/base/build/include
- includes
- libraries/base/include

---

source_paths:
- libraries/ghc-bignum

exclude_paths:
- libraries/ghc-bignum/src/GHC/Num/Backend/Selected.hs

cpp_includes:
- libraries/ghc-bignum/include

---

source_paths:
- libraries/ghc-boot
- libraries/ghc-boot-th
- libraries/ghc-compact
- libraries/ghc-heap
- libraries/ghc-prim

exclude_paths:
- libraries/ghc-compact/tests
- libraries/ghc-heap/tests
- libraries/ghc-prim/tests

Acknowledgments

Thanks to Marcin Szamotulski for his work on ghc-tags-plugin ghc-tags is based on.