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

Feature request: Generate tags for dependent haskell packages #1

Open jsynacek opened 3 years ago

jsynacek commented 3 years ago

It would be nice to have an option (maybe not enabled by default) to also generate tags for the dependent packages specified in the cabal file, including base. There is a project that does something similar, see https://github.com/ierton/haskdogs.

jimenezrick commented 2 years ago

Yeah, something like this: https://github.com/aloiscochard/codex Which you can use to index all dependent packages very easily.

arybczak commented 2 years ago

Oh, I didn't know about codex. Wouldn't it be better to add support of ghc-tags to codex though, considering it can already handle both hasktags and ctags?

jimenezrick commented 2 years ago

ghc-tags looks feature rich and tightly integrated with GHC, which i think is great, my personal preference would be to enhance ghc-tags to be more cabal/project aware and locate all the source files all of the packages to index, but that's just me preference.

The support inside codex would be more ad-hoc, but again, just my 2c.

jimenezrick commented 2 years ago

I was having a look how codex does it, and cabal downloads all the source files used for build under ~/.cabal/packages/hackage.haskell.org, the problem is, it ends up in there as tarballs. Seems like codex identifies the dependent packages and unpack them: https://github.com/aloiscochard/codex/blob/6edbdc34357d13e52b434c19665725684cdd2dba/src/Codex.hs#L148

If we would get all the tarballs unpacked (we could use a bash script), we could run ghc-tags recursively under ~/.cabal/packages/hackage.haskell.org directly as i saw:

  source_paths - a list of paths for ghc-tags to process. Directories are traversed recursively.

Just thinking that with a simple script, ghc-tags can run directly there and give you some tags out of the box as it is now :)

jimenezrick commented 2 years ago

I was playing doing some plumbing with these tools:

...and success :)

jimenezrick commented 2 years ago

Just for awareness, i ended up writing a small tool for this: https://github.com/jimenezrick/cabal-project-tags