Opened 14 months ago

Last modified 13 months ago

#15680 new bug

Flag for printing absolute paths in diagnostics

Reported by: quasicomputational Owned by:
Priority: normal Milestone: 8.6.1
Component: Compiler Version: 8.6.1
Keywords: Cc: Wizek
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Currently, GHC will produce errors and warnings with relative paths pointing to the input that caused it.

This is less than ideal for any tooling consuming these diagnostics, because build tools will concurrently build many packages in different working directories and interleave the output from multiple GHC invocations.

In particular, this makes using next-error in emacs a lot less useful than it could be with cabal-install's output.

Stack has some rather hackish code to post-process the diagnostics and to turn the relative paths absolute. I can personally report that this makes the development process a lot more pleasant!

I think it'd be much cleaner to have a GHC flag for this at the source. -fabsolute-diagnostic-paths or something similar, subject to bikeshedding.

I had a look at implementing this myself, and mkLocMessageAnn in ErrUtils would be the locus of the change. However, I can't figure out how that function should learn what the current working directory is! Any tips? Is that information lurking somewhere in DynFlags?

Change History (1)

comment:1 Changed 13 months ago by Wizek

Cc: Wizek added

I am also interested in this.

Note: See TracTickets for help on using tickets.