ghc-tags icon indicating copy to clipboard operation
ghc-tags copied to clipboard

Feature request: Generate tags for dependent haskell packages

Open jsynacek opened this issue 3 years ago • 6 comments

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.

jsynacek avatar May 19 '21 09:05 jsynacek

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

jimenezrick avatar Nov 23 '21 10:11 jimenezrick

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?

arybczak avatar Nov 23 '21 13:11 arybczak

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 avatar Nov 23 '21 22:11 jimenezrick

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 avatar Nov 24 '21 11:11 jimenezrick

I was playing doing some plumbing with these tools:

  • cabal-plan: to show the exact dependencies of the current project
  • poor man's script (bash): to unpack those dependencies source tarballs from ~/.cabal/packages/hackage.haskell.org
  • ghc-tags: to index all those folders

...and success :)

jimenezrick avatar Nov 24 '21 13:11 jimenezrick

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

jimenezrick avatar Jan 30 '22 23:01 jimenezrick