-
Notifications
You must be signed in to change notification settings - Fork 346
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
let AbsolutePath do the Uri encoding #277
Conversation
on Windows, more than just prepending file: is needed
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.
LGTM 👍
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.
Good 👍 Does it fix some failures in #276?
It locally fixes some bugs in #276 - maybe all URI bugs - but CI isn't positive. I probably need to use your CI as my unix test env. |
Heads up on #275, it touches a big chunk of the codebase. The test failures may be cause by the implicit requirement that those uris need to be formatted as |
|
That comment is correct (also see the linked issue) and without your change I see in my local logs |
I thought as well that all URIs should be
|
@martijnhoekstra it fails because the same hack is hardcoded in the tests 😬
So you need to change it there too. UPD: no, I guess it's not the reason either. There are several places in the code doing these conversions in different way. At some point |
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.
Good catch @laughedelic !
Uri
was intended to unify all usages of URIs in the codebase, so that what we should be using here. java.net.URI
is not used because they do not have structural equality in their string form.
val filename = s"file:${cwd.resolve(d.filename)}" | ||
sdb.documents.map { d => //round and round we go | ||
val absolute = cwd.resolve(d.filename) | ||
val filename = absolute.toURI.toString |
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.
Let's do Uri(absolute).value
and then fix the broken implementation of Uri.apply
def apply(uri: URI): Uri =
new Uri(uri.toString) {}
This part here
if (uri.getScheme == "file") {
// nio.Path.toUri.toString produces file:/// while LSP expected file:/
new Uri(s"file://${uri.getPath}") {}
is broken since URI.getPath
looses the URI encoding 🤦♂️
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.
Good catch @laughedelic !
Uri
was intended to unify all usages of URIs in the codebase, so that what we should be using here. java.net.URI
is not used because they do not have structural equality in their string form.
I can't push this to completion today, unfortunately. Will do so tomorrow. |
@martijnhoekstra no problem. It's even better if you do it after the big refactoring in #275 is merged. |
@martijnhoekstra AppVeyor landed on master, you can rebase if you want to check that the CI is happy too. |
👍 sounds like a plan |
Superseded by #275 I hit on this bug while making the test suite pass |
on Windows, more than just prepending file: is needed