mirror of https://github.com/sbt/sbt.git
Encode POSIX file path to URI using u3 (file:///)
Ref https://github.com/sbt/io/pull/96 Under RFC 8089, both u1 and u3 are legal, but many of the other platforms expect traditional u3. This will increase the compatibility/usability of sbt server, for example to integrate with Vim.
This commit is contained in:
parent
7a8c89effc
commit
06b85919ba
|
|
@ -174,7 +174,7 @@ private[sbt] object Server {
|
|||
auth match {
|
||||
case _ if auth(ServerAuthentication.Token) =>
|
||||
writeTokenfile()
|
||||
PortFile(uri, Option(tokenfile.toString), Option(tokenfile.toURI.toString))
|
||||
PortFile(uri, Option(tokenfile.toString), Option(IO.toURI(tokenfile).toString))
|
||||
case _ =>
|
||||
PortFile(uri, None, None)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import scala.concurrent.Await
|
|||
import scala.concurrent.duration.Duration
|
||||
import scala.util.{ Success, Failure }
|
||||
import sbt.io.syntax._
|
||||
import sbt.io.Hash
|
||||
import sbt.io.{ Hash, IO }
|
||||
import sbt.internal.server._
|
||||
import sbt.internal.langserver.{ LogMessageParams, MessageType }
|
||||
import sbt.internal.util.{ StringEvent, ObjectEvent, MainAppender }
|
||||
|
|
@ -135,7 +135,7 @@ private[sbt] final class CommandExchange {
|
|||
case Some(_) => // do nothing
|
||||
case _ =>
|
||||
val portfile = (new File(".")).getAbsoluteFile / "project" / "target" / "active.json"
|
||||
val h = Hash.halfHashString(portfile.toURI.toString)
|
||||
val h = Hash.halfHashString(IO.toURI(portfile).toString)
|
||||
val tokenfile = BuildPaths.getGlobalBase(s) / "server" / h / "token.json"
|
||||
val socketfile = BuildPaths.getGlobalBase(s) / "server" / h / "sock"
|
||||
val pipeName = "sbt-server-" + h
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ package sbt
|
|||
package internal
|
||||
package server
|
||||
|
||||
import sbt.io.IO
|
||||
import sbt.internal.inc.MixedAnalyzingCompiler
|
||||
import sbt.internal.langserver.ErrorCodes
|
||||
import sbt.util.Logger
|
||||
|
|
@ -297,7 +298,7 @@ private[sbt] object Definition {
|
|||
textProcessor.markPosition(classFile, sym).collect {
|
||||
case (file, line, from, to) =>
|
||||
import sbt.internal.langserver.{ Location, Position, Range }
|
||||
Location(file.toURI.toURL.toString,
|
||||
Location(IO.toURI(file).toString,
|
||||
Range(Position(line, from), Position(line, to)))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import sbt.internal.langserver.{
|
|||
import sbt.internal.inc.JavaInterfaceUtil._
|
||||
import scala.collection.mutable
|
||||
import scala.collection.JavaConverters._
|
||||
import sbt.io.IO
|
||||
|
||||
/**
|
||||
* Defines a compiler reporter that uses event logging provided by a [[ManagedLogger]].
|
||||
|
|
@ -82,7 +83,7 @@ class LanguageServerReporter(
|
|||
import sbt.internal.langserver.codec.JsonProtocol._
|
||||
val files = analysis.readSourceInfos.getAllSourceInfos.keySet.asScala
|
||||
files foreach { f =>
|
||||
val params = PublishDiagnosticsParams(f.toURI.toString, Vector())
|
||||
val params = PublishDiagnosticsParams(IO.toURI(f).toString, Vector())
|
||||
exchange.notifyEvent("textDocument/publishDiagnostics", params)
|
||||
}
|
||||
}
|
||||
|
|
@ -94,7 +95,7 @@ class LanguageServerReporter(
|
|||
problemsByFile.get(sourceFile) match {
|
||||
case Some(xs: List[Problem]) =>
|
||||
val ds = toDiagnostics(xs)
|
||||
val params = PublishDiagnosticsParams(sourceFile.toURI.toString, ds)
|
||||
val params = PublishDiagnosticsParams(IO.toURI(sourceFile).toString, ds)
|
||||
exchange.notifyEvent("textDocument/publishDiagnostics", params)
|
||||
case _ =>
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue