diff --git a/resources/META-INF/pants-scala.xml b/resources/META-INF/pants-scala.xml index 6390a5c94..aff2e89e6 100644 --- a/resources/META-INF/pants-scala.xml +++ b/resources/META-INF/pants-scala.xml @@ -13,6 +13,7 @@ + diff --git a/src/com/twitter/intellij/pants/service/scala/PantsBspResolverNamingExtension.scala b/src/com/twitter/intellij/pants/service/scala/PantsBspResolverNamingExtension.scala new file mode 100644 index 000000000..c47ab8b8e --- /dev/null +++ b/src/com/twitter/intellij/pants/service/scala/PantsBspResolverNamingExtension.scala @@ -0,0 +1,21 @@ +// Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). +// Licensed under the Apache License, Version 2.0 (see LICENSE). + +package com.twitter.intellij.pants.service.scala + +import org.jetbrains.bsp.project.resolver.BspResolverNamingExtension +import org.jetbrains.bsp.project.resolver.BspResolverDescriptors.ModuleDescription + +class PantsBspResolverNamingExtension extends BspResolverNamingExtension { + + def libraryData(moduleDescription: ModuleDescription): Option[String] = shortName("dependencies", moduleDescription) + + def libraryTestData(moduleDescription: ModuleDescription): Option[String] = shortName("test dependencies", moduleDescription) + + private def shortName(suffix: String, moduleDescription: ModuleDescription): Option[String] = { + val name = moduleDescription.data.name + val shortName = name.split(":").last + Some(s"$shortName $suffix") + } + +}