Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.sbtidea.Keys.*
import org.jetbrains.sbtidea.verifier.FailureLevel

lazy val scala3Version = "3.6.4"
lazy val scala3Version = "3.7.1"
lazy val logbackVersion = "1.5.18"
lazy val graphvizVersion = "0.18.1"
lazy val joorVersion = "0.9.15"
Expand All @@ -12,8 +12,8 @@ lazy val jbAnnotVersion = "26.0.2"

// https://youtrack.jetbrains.com/articles/IDEA-A-2100661679/IntelliJ-IDEA-2023.3-Latest-Builds
// NOTE: Latest-Builds 233
lazy val intellijVersion = "251.23536.34"
lazy val pluginVersion = s"0.7.0-$intellijVersion"
lazy val intellijVersion = "251.26927.53"
lazy val pluginVersion = s"0.7.1-$intellijVersion"

ThisBuild / version := pluginVersion

Expand Down Expand Up @@ -44,8 +44,11 @@ lazy val `sbt-dependency-analyzer` = (project in file("."))
organization := "org.bitlap",
scalacOptions ++= Seq(
"-deprecation",
"-Xfatal-warnings"
/** , "-rewrite", "-source:3.4-migration"* */
"-Xfatal-warnings",
"-Ybackend-parallelism:16" // https://github.com/scala/scala3/pull/15392
// "-nowarn", // during migration
// "-rewrite",
// "-source:3.7-migration"
),
version := (ThisBuild / version).value,
ThisBuild / intellijPluginName := "Sbt Dependency Analyzer",
Expand All @@ -62,6 +65,7 @@ lazy val `sbt-dependency-analyzer` = (project in file("."))
offline = true, // forbid the verifier from reaching the internet
failureLevels = Set(FailureLevel.COMPATIBILITY_PROBLEMS, FailureLevel.COMPATIBILITY_WARNINGS)
),
autoRemoveOldCachedIntelliJSDK := true,
Global / intellijAttachSources := true,
intellijPlugins ++= Seq("com.intellij.java", "com.intellij.java-i18n", "org.intellij.scala").map(_.toPlugin),
Compile / unmanagedResourceDirectories += baseDirectory.value / "src" / "main" / "resources",
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.11.2
sbt.version=1.11.3
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ ThisBuild / resolvers ++= Seq(
"Sonatype OSS Releases" at "https://s01.oss.sonatype.org/content/repositories/releases"
)
addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "1.1.0")
addSbtPlugin("org.jetbrains" % "sbt-idea-plugin" % "4.1.11")
addSbtPlugin("org.jetbrains" % "sbt-idea-plugin" % "4.1.17")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.4")
addSbtPlugin("org.bitlap" % "sbt-kotlin-plugin" % "4.0.1")
8 changes: 7 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<idea-plugin>
<id>org.bitlap.sbtDependencyAnalyzer</id>
<name>Sbt Dependency Analyzer</name>
<version>0.7.0-251.23536.34</version>
<version>0.7.1-251.26927.53</version>
<vendor url="https://github.com/bitlap/intellij-sbt-dependency-analyzer" email="dreamylost@outlook.com">Bitlap
</vendor>
<!-- please see https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html for description -->
Expand Down Expand Up @@ -136,6 +136,12 @@

<![CDATA[

<h1>0.7.1-251.26927.53</h1>
<ul>
<li>Fix warnings .</li>
</ul>
<!-- @@ -->

<h1>0.7.0-251.23536.34</h1>
<ul>
<li>Support IDEA 251.x .</li>
Expand Down
23 changes: 11 additions & 12 deletions src/main/scala/bitlap/sbt/analyzer/util/SbtDependencyUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,7 @@ object SbtDependencyUtils {
infix.getText.split('%').filter(_.nonEmpty)
case _: ScReferenceExpression =>
infix.getText.split('%').filter(_.nonEmpty)
case _ =>
Array.empty[String]()
case _ => Array.empty[String]

if (fixedSplits.length == 3) {
result ++= Seq((infix, fixedSplits(1), infix))
Expand Down Expand Up @@ -547,7 +546,7 @@ object SbtDependencyUtils {
case _ => None
}
case file: PsiFile =>
Option(addDependencyToFile(file, info)(project))
Option(addDependencyToFile(file, info)(using project))
case _ => None
}
}
Expand All @@ -557,7 +556,7 @@ object SbtDependencyUtils {
): Option[PsiElement] = {
expr match {
case file: PsiFile =>
Option(addRepositoryToFile(file, unifiedDependencyRepository)(project))
Option(addRepositoryToFile(file, unifiedDependencyRepository)(using project))
case _ => None
}
}
Expand All @@ -577,7 +576,7 @@ object SbtDependencyUtils {
{
seqCall.args.addExpr(dependency.copy().asInstanceOf[ScExpression])
seqCall.args.addExpr(generateArtifactPsiExpression(info, infix))
infix.operation.replace(ScalaPsiElementFactory.createElementFromText("++=", infix)(project))
infix.operation.replace(ScalaPsiElementFactory.createElementFromText("++=", infix)(using project))
dependency.replace(seqCall)
},
psiFile
Expand All @@ -599,7 +598,7 @@ object SbtDependencyUtils {
ScalaPsiElementFactory.createExpressionFromText(
s"${subInfix.getText} ++ Seq(${generateArtifactText(info)})",
infix
)(project)
)(using project)
),
psiFile
)
Expand Down Expand Up @@ -640,7 +639,7 @@ object SbtDependencyUtils {
var addedExpr: PsiElement = null
doInSbtWriteCommandAction(
{
file.addAfter(generateNewLine(project), file.getLastChild)
file.addAfter(generateNewLine(using project), file.getLastChild)
addedExpr = file.addAfter(generateLibraryDependency(info, file), file.getLastChild)
},
file
Expand All @@ -665,7 +664,7 @@ object SbtDependencyUtils {
var addedExpr: PsiElement = null
doInSbtWriteCommandAction(
{
file.addAfter(generateNewLine(project), file.getLastChild)
file.addAfter(generateNewLine(using project), file.getLastChild)
addedExpr = file.addAfter(generateResolverPsiExpression(unifiedDependencyRepository, file), file.getLastChild)
},
file
Expand All @@ -685,19 +684,19 @@ object SbtDependencyUtils {
.compute(() => f)

private def generateSeqPsiMethodCall(ctx: PsiElement): ScMethodCall =
ScalaPsiElementFactory.createElementFromText[ScMethodCall](s"$SEQ()", ctx)(ctx)
ScalaPsiElementFactory.createElementFromText[ScMethodCall](s"$SEQ()", ctx)(using ctx)

private def generateLibraryDependency(info: SbtArtifactInfo, ctx: PsiElement): ScInfixExpr =
ScalaPsiElementFactory.createElementFromText[ScInfixExpr](
s"$LIBRARY_DEPENDENCIES += ${generateArtifactText(info)}",
ctx
)(ctx)
)(using ctx)

def generateArtifactPsiExpression(info: SbtArtifactInfo, ctx: PsiElement): ScExpression =
ScalaPsiElementFactory.createElementFromText[ScExpression](
generateArtifactText(info),
ctx
)(ctx)
)(using ctx)

private def generateNewLine(implicit ctx: ProjectContext): PsiElement =
ScalaPsiElementFactory.createNewLine()
Expand Down Expand Up @@ -730,7 +729,7 @@ object SbtDependencyUtils {
unifiedDependencyRepository: UnifiedDependencyRepository,
ctx: PsiElement
): ScExpression =
ScalaPsiElementFactory.createExpressionFromText(generateResolverText(unifiedDependencyRepository), ctx)(ctx)
ScalaPsiElementFactory.createExpressionFromText(generateResolverText(unifiedDependencyRepository), ctx)(using ctx)

def getRelativePath(elem: PsiElement)(implicit project: ProjectContext): Option[String] = {
for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ object SbtDependencyModifier extends ExternalDependencyModificator {
val wizard = new AddDependencyPreviewWizard(project, newArtifactInfo, dependencyPlaces)
wizard.search() match {
case Some(fileLine) =>
SbtDependencyUtils.addDependency(fileLine.element, newArtifactInfo)(project)
SbtDependencyUtils.addDependency(fileLine.element, newArtifactInfo)(using project)
case _ =>
}
}
Expand Down Expand Up @@ -191,7 +191,7 @@ object SbtDependencyModifier extends ExternalDependencyModificator {

override def declaredRepositories(module: OpenapiModule.Module): util.List[UnifiedDependencyRepository] = try {
SbtResolverUtils
.projectResolvers(module.getProject)
.projectResolvers(using module.getProject)
.collect { case r: SbtMavenResolver =>
new UnifiedDependencyRepository(r.name, r.presentableName, r.normalizedRoot)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private class SbtPossiblePlacesPanel(
private def updateEditor(myCurFileLine: DependencyOrRepositoryPlaceInfo): Unit = {
val document =
FileDocumentManager.getInstance.getDocument(project.baseDir.findFileByRelativePath(myCurFileLine.path))
val tmpFile = ScalaPsiElementFactory.createScalaFileFromText(document.getText, myCurFileLine.element)(project)
val tmpFile = ScalaPsiElementFactory.createScalaFileFromText(document.getText, myCurFileLine.element)(using project)
var tmpElement = tmpFile.findElementAt(myCurFileLine.element.getTextOffset)
while (tmpElement.getTextRange != myCurFileLine.element.getTextRange) {
tmpElement = tmpElement.getParent
Expand All @@ -91,9 +91,9 @@ private class SbtPossiblePlacesPanel(
var dep: Option[PsiElement] = null
wizard.elementToAdd match {
case info: SbtArtifactInfo =>
dep = SbtDependencyUtils.addDependency(tmpElement, info)(project)
dep = SbtDependencyUtils.addDependency(tmpElement, info)(using project)
case repo: UnifiedDependencyRepository =>
dep = SbtDependencyUtils.addRepository(tmpElement, repo)(project)
dep = SbtDependencyUtils.addRepository(tmpElement, repo)(using project)
}

inWriteAction {
Expand Down
Loading