arybczak / ghc-tags

A command line tool that leverages GHC API for generation of etags (Emacs) and ctags (Vim, VSCode with ctagsx etc.) for efficient code navigation (jump to definition).
Mozilla Public License 2.0
21 stars 3 forks source link

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:

Supported file extensions:

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:

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.