-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some minor usability fixes #321
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR's!. I've merged the doc comment about For the For making paths absolute, I don't think that's the right place, and many users will prefer to see relative paths as they are shorter but equally descriptive. Having an |
5e74791
to
dd4c0a8
Compare
Updated, made the one remaining feature gated behind commandline flag.
yeah, I agree - the default should be the exact output from ghci.
Done; I have named it
I agree. It is just that contributing to cabal is a much slower and time-consuming process, for some reason. I'd rather get this fixed right now. (See haskell/cabal#5001 and haskell/cabal#1842 for some relevant tickets.)
I don't entirely follow; my original PR here already relied on the Oh, and you were right, specifying the desired component allows using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, adding force absolute paths behind a flag doesn't seem unreasonable. And I can see why its easier to get it into ghcid, so that's not a big deal. I don't quite see how it works though - what if loadMessage was empty? How do you know this isn't losing information or switching file information?
_ | not replacePaths -> l | ||
"" -> l | ||
c : _ | isSpace c -> l | ||
_ -> if "hs:" `isInfixOf` l |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this looks for Foo.hs:
where hs:
is the suffix of that string, and replaces it with loadFile
? What if you don't have loadFile as the absolute version of this file, but it's a different file? That seems a dangerous operation to do.
I don't understand. Why would Note that if
do you mean because the replace might catch more than a file path? yeah, this trusts on the compiler having consistent output.
As I understand, you consider the case where the message mentions a file that is entirely different from the |
so the relative paths are written just like Apart from the color escape code, would this be an acceptable solution to this? And do you have an idea on how to handle the escape code? |
(I can understand if this workaround is becoming too complex for its own good and you'd rather not merge. I may point out that I have been using this flag without any issue for some weeks now. Maybe just clearly documenting it as an "experimental workaround" would be a compromise? I don't want to spend many more iterations on upstreaming this thing either..) |
cabal repl switches current directory for subpackages of a project, resulting in error paths relative to some subdirectory. This confuses downstream tooling. Related cabal tickets are haskell/cabal#5001 haskell/cabal#1842 Gated behind the newly added flag --force-absolute-paths
Thanks for your continued work on ghcid. It is an essential haskell tool.
These are a few random fixes for minor issues. I have put them in four different commits so feel to cherry-pick the ones that you like and leave the rest. I hope it is fine that I use one PR instead of four.
In order of the commits
cabal repl
did work for me in the source dir ofghcid
due to the.ghci
file. Not sure what it is supposed to be doing, but I deleted it and it worked. I guess this breaks the tests? I am confused about the setup.-c
--command
there are no default--restart
conditions any longer.(N.B. this changes how often options are parsed. This is harmless/an improvement, right?)
cabal v2-repl
likes tocd
into the package path, so all paths are relative to some subdirectory. This confuses my downstream tooling, so I added a hack to make the paths absolute (relying onloadFile
). Is hacky, but works (and might work for both.hs
and.lhs
. But not hs-boot, now that I think of it..) There might neater ways of doing a string replacement, but I don't know the CWD so I don't know which path to replace.