-
Notifications
You must be signed in to change notification settings - Fork 32
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
Consider not using canonicalizePath
#67
Comments
Another option would be to "normalize" the URI in a slightly different sense: when the diagnostics are published in HIE, we could replace the base of the URI with HIE's project root, which would hopefully induce the correct casing. |
I am happy to use makeAbsolute instead of canonicalize, I must admit I am not sure what the differences are. |
Cool! I will try it out and PR it if it works :) It seems like
I will also try running |
This is to help vscode on windows, see RefactoringTools#67
@johnsonwj See my ghc-8.4 branch, I made the change. I am contemplating passing the |
Ah, awesome! I am away from my Windows machine right now but will try it out later. In the meantime I can try it out on osx. |
There is a long-standing issue in VS Code that causes diagnostic reports (such as via
haskell-lsp
) to be treated as if they apply to a different file on case-insensitive file systems, if Code was opened in a non-canonically-cased path.For example:
According to the HIE log,
haskell-lsp
was initialized in the directoryc:\users\myself\documents\projects\my-project
and HaRe is sending back messages for the URI
file:///C%3A/Users/myself/Documents/Projects/my-project/Thingy.hs
.The associated diagnostics (squiggles etc.) do not appear in the expected editor window; instead, VS Code reports a problem in what appears to be a distinct file, at the canonicalized path, which by this point is out of sync with my original file (since it lacks changes that had not yet been saved to disk).
There are a couple of workarounds for this:
code
on the command line, which automatically corrects casingThis still leaves the issue as a gotcha if the user happens to overlook an incorrectly-cased directory at the command prompt. Given that the VS Code issue has been open for a year and a half, with several apparently unsuccessful attempts at resolving it, I wonder if it would be easier to fix it here by avoiding changing the casing on the path after refactoring.
Unfortunately I don't know enough about how HaRe works to know if that would break other stuff. Does anyone know if it is sufficient to call
System.Directory.makeAbsolute
, or is the canonicalization necessary for other reasons so we cannot address it here?Relevant commits include
The text was updated successfully, but these errors were encountered: