Flag for printing absolute paths in diagnostics
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
?
Trac metadata
Trac field | Value |
---|---|
Version | 8.6.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |