Skip to content

Commit

Permalink
Fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Jul 5, 2021
1 parent d1a86f8 commit 8bd8be2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ package org.enso.languageserver.filemanager
import akka.actor.{ActorRef, ActorSystem}
import akka.testkit.{TestDuration, TestKit, TestProbe}
import org.apache.commons.lang3.SystemUtils
import org.enso.editions.{LibraryName, LibraryVersion}
import org.enso.languageserver.data._
import org.enso.languageserver.filemanager.ContentRootManagerProtocol.{
ContentRootsAddedNotification,
SubscribeToNotifications
}
import org.enso.polyglot.runtime.Runtime.Api
import org.enso.testkit.EitherValue
import org.scalatest.{Inside, OptionValues}
import org.scalatest.concurrent.Futures
import org.scalatest.concurrent.ScalaFutures.convertScalaFuture
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpecLike
import org.scalatest.{Inside, OptionValues}

import java.io.File
import java.nio.file.{Path => JPath}
Expand Down Expand Up @@ -87,12 +86,10 @@ class ContentRootManagerSpec
fsRoots should not be empty
}

val libraryName = LibraryName("Foo", "Bar")
val libraryVersion = LibraryVersion.Local
val rootPath = new File("foobar")
val rootPath = new File("foobar")

system.eventStream.publish(
Api.LibraryLoaded(libraryName, libraryVersion, rootPath)
Api.LibraryLoaded("Foo", "Bar", "local", rootPath)
)

inside(subscriberProbe.receiveOne(2.seconds.dilated)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ package org.enso.languageserver.websocket.json

import io.circe.literal._
import io.circe.parser.parse
import nl.gn0s1s.bump.SemVer
import org.apache.commons.io.FileUtils
import org.bouncycastle.util.encoders.Hex
import org.enso.editions.Editions.Repository
import org.enso.editions.{LibraryName, LibraryVersion}
import org.enso.languageserver.data._
import org.enso.polyglot.runtime.Runtime.Api
import org.enso.testkit.RetrySpec
Expand Down Expand Up @@ -1792,15 +1789,10 @@ class FileManagerTest extends BaseServerTest with RetrySpec {

"Content root management" must {
"notify the IDE when a new root is added" in {
val client = getInitialisedWsClient()

val repo = Repository.make("example", "https://example.com/").get

val libraryName = LibraryName("Foo", "Bar")
val libraryVersion = LibraryVersion.Published(SemVer(1, 2, 3), repo)
val rootPath = new File("foobar")
val client = getInitialisedWsClient()
val rootPath = new File("foobar")
system.eventStream.publish(
Api.LibraryLoaded(libraryName, libraryVersion, rootPath)
Api.LibraryLoaded("Foo", "Bar", "1.2.3", rootPath)
)

val parsed = parse(client.expectMessage())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ object PackageRepository {
newName: String
): Unit = {
val toChange = loadedPackages.toSeq.filter { case (name, _) =>
name.prefix == namespace && name.name == oldName
name.namespace == namespace && name.name == oldName
}

for ((key, _) <- toChange) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ object NotificationHandler {
location: Path
): Unit = sendMessage(
Api.LibraryLoaded(
namespace = libraryName.prefix,
namespace = libraryName.namespace,
name = libraryName.name,
version = libraryVersion.toString,
location = location.toFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DefaultLocalLibraryProvider(searchPaths: List[Path])
searchPaths: List[Path]
): Option[Path] = searchPaths match {
case head :: tail =>
val potentialPath = head / libraryName.prefix / libraryName.name
val potentialPath = head / libraryName.namespace / libraryName.name
if (Files.exists(potentialPath) && Files.isDirectory(potentialPath)) {
logger.trace(
s"Found a local $libraryName at " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ object LibraryCache {
*/
def resolvePath(root: Path, libraryName: LibraryName, version: SemVer): Path =
root
.resolve(libraryName.prefix)
.resolve(libraryName.namespace)
.resolve(libraryName.name)
.resolve(version.toString)
}

0 comments on commit 8bd8be2

Please sign in to comment.