Skip to content

Commit

Permalink
Update to 2023.3 EAP
Browse files Browse the repository at this point in the history
  • Loading branch information
hmemcpy committed Oct 9, 2023
1 parent 43da27b commit 47f1733
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: CI
on:
push:
branches:
- idea222.x
- idea223.x
- idea231.x
- idea232.x
- idea233.x
pull_request:

jobs:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ A note about support: this plugin is maintained for the last two IntelliJ IDEA v
To continue enjoying new features, please upgrade to the latest available IntellJ version!

**Currently supported**:
* 2023.3 (EAP)
* 2023.2 (current release)
* 2023.1

Expand Down
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import org.jetbrains.sbtidea.{AutoJbr, JbrPlatform}

lazy val scala213 = "2.13.10"
lazy val scalaPluginVersion = "2023.2.23"
lazy val pluginVersion = "2023.2.27" + sys.env.get("ZIO_INTELLIJ_BUILD_NUMBER").fold(".0")(v => s".$v")
lazy val scalaPluginVersion = "2023.3.3"
lazy val pluginVersion = "2023.3.27" + sys.env.get("ZIO_INTELLIJ_BUILD_NUMBER").fold(".0")(v => s".$v")

ThisBuild / intellijPluginName := "zio-intellij"
ThisBuild / intellijBuild := "232.9921.28"
ThisBuild / intellijBuild := "233"
ThisBuild / jbrInfo := AutoJbr(explicitPlatform = Some(JbrPlatform.osx_aarch64))

Global / intellijAttachSources := true
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<change-notes>replaced-by-build</change-notes>

<idea-version since-build="232" until-build="232.*"/>
<idea-version since-build="233" until-build="233.*"/>

<depends>org.intellij.scala</depends>
<depends>com.intellij.modules.java</depends>
Expand Down
15 changes: 10 additions & 5 deletions src/main/scala/zio/intellij/inspections/ZInspection.scala
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package zio.intellij.inspections

import com.intellij.codeInspection.ProblemsHolder
import com.intellij.codeInspection.{ProblemHighlightType, ProblemsHolder}
import com.intellij.psi.PsiElement
import org.jetbrains.plugins.scala.codeInspection
import org.jetbrains.plugins.scala.codeInspection.PsiElementVisitorSimple

import javax.swing.JComponent
import org.jetbrains.plugins.scala.codeInspection.collections.OperationOnCollectionInspectionBase.SimplifiableExpression
import org.jetbrains.plugins.scala.codeInspection.collections._
import org.jetbrains.plugins.scala.lang.psi.ScalaPsiUtil
import org.jetbrains.plugins.scala.lang.psi.api.expr.ScExpression
import zio.intellij.utils.{ModuleSyntax, Version}

import javax.swing.JComponent

abstract class ZInspection(simplifiers: SimplificationType*) extends OperationOnCollectionInspection {
final override def getLikeCollectionClasses: Seq[String] = List("zio.ZIO")

Expand All @@ -31,7 +30,13 @@ abstract class ZInspection(simplifiers: SimplificationType*) extends OperationOn
simplifications(expr).foreach {
case s @ Simplification(toReplace, _, hint, rangeInParent) =>
val quickFix = OperationOnCollectionQuickFix(s)
holder.registerProblem(toReplace.getElement, hint, highlightType, rangeInParent, quickFix)
holder.registerProblem(
toReplace.getElement,
hint,
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
rangeInParent,
quickFix
)
}
case _ =>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object SimplifyEqualToType extends SimplificationType {
override def hint: String = "Replace with assertTrue"

def replacement(expr: ScExpression, body: String): Simplification =
replace(expr).withText(s"assertTrue($body").highlightAll
replace(expr).withText(s"assertTrue($body)").highlightAll

override def getSimplification(expr: ScExpression): Option[Simplification] =
expr match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ object ZStrategy {

override def wildcardPatternWithoutType(pattern: ScWildcardPattern): Boolean = false

override def patternWithType(pattern: ScTypedPattern): Boolean = false

override def parameterWithoutType(param: ScParameter): Boolean = false

override def parameterWithType(param: ScParameter): Boolean = false
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/zio/intellij/project/ZioProjectBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.jetbrains.plugins.scala.extensions.JComponentExt.ActionListenersOwner
import org.jetbrains.plugins.scala.extensions._
import org.jetbrains.plugins.scala.project.template.ScalaVersionDownloadingDialog
import org.jetbrains.plugins.scala.project.{ScalaLanguageLevel, Version, Versions}
import org.jetbrains.plugins.scala.util.HttpDownloadUtil
import org.jetbrains.plugins.scala.{extensions, ScalaBundle, ScalaVersion}
import org.jetbrains.sbt.project.template.{SComboBox, SbtModuleBuilderBase, ScalaSettingsStepBase}
import org.jetbrains.sbt.{Sbt, SbtBundle}
Expand Down Expand Up @@ -81,7 +82,7 @@ private[zio] class ZioProjectBuilder extends SbtModuleBuilderBase {

def loadVersions = {
val url = s"https://repo1.maven.org/maven2/dev/zio/zio_$versionStr/"
val lines = Versions.loadLinesFrom(url)
val lines = HttpDownloadUtil.loadLinesFrom(url, false, None)
val versionStrings = lines.fold(
Function.const(hardcodedZioVersions.versions),
extractVersions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.apache.commons.lang.StringEscapeUtils
import org.jetbrains.plugins.scala.lang.psi.ScalaPsiUtil
import org.jetbrains.plugins.scala.lang.psi.api.base.ScAnnotation
import org.jetbrains.plugins.scala.lang.psi.api.statements.params._
import org.jetbrains.plugins.scala.lang.psi.types.api.presentation.TextEscaper
import org.jetbrains.plugins.scala.lang.psi.types.{ScType, TypePresentationContext}
import org.jetbrains.plugins.scala.lang.refactoring.util.ScTypeUtil

Expand Down Expand Up @@ -142,5 +143,5 @@ package object presentation {
buffer.toString()
}

private def escape(text: String): String = StringEscapeUtils.escapeHtml(text)
private def escape(text: String): String = TextEscaper.Html.escape(text)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private[testsupport] final class TestRunnerProjectNotification(private val proje
}

private def shouldSuggestTestRunner(project: Project, downloadIfMissing: Boolean = false): Boolean = {
val zioVersions = project.versions.map(_._1)
val zioVersions = project.versions.map(_._1)
// Sometimes there are mixed ZIO versions in the project.
// Only offer downloading the test runner if all projects use ZIO 1.0
if (zioVersions.forall(_.requiresTestRunner)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,49 +646,45 @@ class ZioAccessorUsagesSearcherTest extends ScalaAnnotatorQuickFixTestBase with
""".stripMargin))

def testMacrosZIO2StyleVal(): Unit =
doTest(base(
s"""@accessible
|trait FindMyAccessors {
| val method$CARET: UIO[Int] = ???
|}
|
|${start}FindMyAccessors.method$end
doTest(base(s"""@accessible
|trait FindMyAccessors {
| val method$CARET: UIO[Int] = ???
|}
|
|${start}FindMyAccessors.method$end
""".stripMargin))

def testMacrosZIO2StyleDef(): Unit =
doTest(base(
s"""@accessible
|trait FindMyAccessors {
| def method$CARET: UIO[Int] = ???
|}
|
|${start}FindMyAccessors.method$end
doTest(base(s"""@accessible
|trait FindMyAccessors {
| def method$CARET: UIO[Int] = ???
|}
|
|${start}FindMyAccessors.method$end
""".stripMargin))

def testZIO2StyleVal(): Unit =
doTest(base(
s"""trait FindMyAccessors {
| val method$CARET: UIO[Int] = ???
|}
|
|object FindMyAccessors {
| val method: URIO[Has[FindMyAccessors], Int] = ???
|}
|
|${start}FindMyAccessors.method$end
doTest(base(s"""trait FindMyAccessors {
| val method$CARET: UIO[Int] = ???
|}
|
|object FindMyAccessors {
| val method: URIO[Has[FindMyAccessors], Int] = ???
|}
|
|${start}FindMyAccessors.method$end
""".stripMargin))

def testZIO2StyleDef(): Unit =
doTest(base(
s"""trait FindMyAccessors {
| def method$CARET: UIO[Int] = ???
|}
|
|object FindMyAccessors {
| def method: URIO[Has[FindMyAccessors], Int] = ???
|}
|
|${start}FindMyAccessors.method$end
doTest(base(s"""trait FindMyAccessors {
| def method$CARET: UIO[Int] = ???
|}
|
|object FindMyAccessors {
| def method: URIO[Has[FindMyAccessors], Int] = ???
|}
|
|${start}FindMyAccessors.method$end
""".stripMargin))

override protected def description: String = ""
Expand Down

0 comments on commit 47f1733

Please sign in to comment.