-
Notifications
You must be signed in to change notification settings - Fork 89
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
Normalize file paths before converting to Uri's #205
Conversation
I am afraid (as @mpickering suspected) that this pr dont ensure all So the only way to ensure is to move the code doing the upper case to |
NormalizedUri $ T.pack $ escapeURIString isUnescapedInURI $ unEscapeString $ T.unpack t | ||
where (Uri t) = maybe uri filePathToUri (uriToFilePath uri) |
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.
I am not sure if it is the best way to do it.
filepathToUri
main work is to prepare FilePath
to convert it to Uri
(except making the driver letter upper case)
I've found that fixing the keys of the VFS with this change makes hlint suggestions appear again in vscode: So it would fix haskell/haskell-ide-engine#1441 and other related issues in hie. |
So, you think that actual impl can be acceptable @alanz @cocreature ?
But this would be a breaking change |
If I recall correctly, fairly early on in HIE development we decided to always use absolute paths, and have nothing relative to And for an index into the VFS, an absolute, normalized path makes sense. |
Ok, i've changed the code to use FP.normalise so:
So the resultants uris are more likely to be unique than before I've updated the tests to cover the above changes and to prove that conversions works with paths using unicode chars. However i've not add any restriction over relative paths. It would suppose:
I think it should belong to another pr cause the objective of this one would be fix uniqueness of uris as map keys. So for me this could be merged. |
The tests with unicode paths are failing for some environments (or seeds?), investigating |
It seems we hit this issue with unicode generation so i've applied the same patch than this pr |
@jneira If you are happy with this it can merge. |
@alanz yeah i think it could be merged |
System.FilePath.normalise
(including make the driver letter upper case) but when i tried to use it some test cases failed so i am not sure if its use was avoided by design.