eed3si9n / sjson-new

a typeclass based JSON codec that's backend independent
Apache License 2.0
36 stars 19 forks source link

Encode POSIX file path to URI using u3 (file:///) #86

Closed eed3si9n closed 6 years ago

eed3si9n commented 6 years ago

Ref https://github.com/sbt/sbt/issues/3801 Ref https://github.com/sbt/io/pull/96

Under RFC 8089, published in February 2017, an aboslute POSIX file path can be encoded into URI in two different ways.

First is file:/etc/hosts with no authority field. Let's call this u1 notation. u1 is the new, minimal representation, and it's what we have been doing (i.e via f.toURI) by accident.

Second is file:///etc/hosts with an empty authority field. Let's call this u3 notation. u3 is how traditionally file path were supposed to be represented in RFC 3986 (2005) and Kerwin draft (2013). Due to sbt server, we are going to interface non-JVM systems that might not be up to RFC 8089.

For example, Vim's LSP sends URI using u3 {"textDocument":{"uri":"file:///Users/foo/work/hellotest/Hello.scala"}}), and more importantly it also expects u3 for the compiler error messages to be notified correctly.

https://github.com/sbt/sbt/issues/3702 reported that Atom also expected u3 notation until https://github.com/atom/atom-languageclient/pull/129 fixed it.

dwijnand commented 6 years ago
[error]  * synthetic method sjsonnew$JavaExtraFormats$_setter_$sjsonnew$JavaExtraFormats$$fileScheme_=(java.lang.String)Unit in trait sjsonnew.JavaExtraFormats is present only in current version
[error]    filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("sjsonnew.JavaExtraFormats.sjsonnew$JavaExtraFormats$_setter_$sjsonnew$JavaExtraFormats$$fileScheme_=")
[error]  * synthetic method sjsonnew$JavaExtraFormats$$fileScheme()java.lang.String in trait sjsonnew.JavaExtraFormats is present only in current version
[error]    filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("sjsonnew.JavaExtraFormats.sjsonnew$JavaExtraFormats$$fileScheme")