ghc-tags-plugin: A compiler plugin which generates tags file from GHC syntax tree.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

A compiler source plugin which takes parsed Haskell syntax tree and saves tags file to disk, leaving the parsed tree untouched.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.2, 0.1.1.0, 0.1.2.0, 0.1.2.1, 0.1.3.0, 0.1.4.0, 0.1.5.0, 0.1.6.0, 0.2.0.0, 0.2.1.0, 0.2.2.0, 0.2.3.0, 0.2.4.0, 0.2.4.1, 0.3.0.0, 0.4.0.0, 0.4.0.1, 0.5.0.0, 0.5.1.0, 0.5.2.0, 0.5.3.0, 0.6.0.0, 0.6.0.1, 0.6.1.0, 0.6.1.1
Change log CHANGELOG.md
Dependencies attoparsec (>=0.13.0.0 && <0.14), base (>=4.12.0.0 && <4.13), bytestring (>=0.10 && <0.11), containers (>=0.6 && <0.7), directory (>=1.3 && <1.4), ghc (>=8.4 && <8.9) [details]
License MPL-2.0
Copyright (c) 2020, Marcin Szamotulski
Author Marcin Szamotulski
Maintainer profunctor@pm.me
Category Development
Home page https://github.com/coot/ghc-tags-plugin#readme
Bug tracker https://github.com/coot/ghc-tags-plugin/issues
Source repo head: git clone https://github.com/coot/ghc-tags-plugin
Uploaded by coot at 2020-03-02T14:28:16Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for ghc-tags-plugin-0.1.0.2

[back to package description]

Ghc Tags Compiler Plugin

A Ghc Compiler Plugin which generates tags for each compiled module or component.

vim configuration

Each generated tags file is put next to the corresponding *.cabal file. If you just have a repo with a cabal file in the main directory vim default tags setting will work, if you have some modules in subdirectories you will need to set:

:set tags+=*/tags

Plugin usage

Configuration of this plugin requires some familiarity with ghc packages. Check out documentation how to use -plugin-package or -plugin-package-id. In the examples below we us -plugin-package=ghc-tags-plugin but specifying version -package=ghc-tags-plugin-0.0.0.0 (where 0.0.0.0 is the version you installed), might work better. You can use ghc-pkg latest (likely with appropriate --package-db flag) to check which version is available.

ghc

ghc -plugin-package=ghc-tags-plugin -fplugin=Plugin.GhcTags

cabal

Install the ghc-tags-plugin to cabal store with:

cabal install ghc-tags-plugin

In cabal.project.local file add package stanza for every local package :

project some-project
    ghc-options: -package-db=PACKAGE_DB -plugin-package=ghc-tags-plugin -fplugin=Plugin.GhcTags

PACKAGE_DB is likely something to be something like (for ghc-8.6.5) '${HOME}/.cabal/store/ghc-8.6.5/package.db' (all environment variables must be expanded).

stack

Install ghc-tags-plugin

stack install ghc-tags-plugin

In stack.yaml file add:

ghc-options:
    some-project: -package-db=PACKAGE_DB -plugin-package=ghc-tags-plugin -fplugin=Plugin.GhcTags

where PACKAGE_DB is the package db where ghc-tags-plugin was installed by stack.

modifying cabal files

You can always add ghc-tags-plugin as a build dependency in a cabal file (for each component). You can hide it behind a flag and then use cabal or stack to enable it (or cabal.project.local or stack.yaml files for that purpose).

Security implications of compiler plugins

Such plugins can:

This plugin only reads & writes to tags file (and updates a shared mutable state) as of IO, and does not modify/ the syntax tree.