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
15 changes: 11 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ idea {

plugins {
idea
kotlin("jvm") version "2.1.20"
kotlin("jvm") version "2.3.20"
id("org.jetbrains.intellij.platform.module") version "2.16.0"
id("org.jetbrains.grammarkit") version "2022.3.2.2"

Expand All @@ -65,6 +65,7 @@ allprojects {
all {
resolutionStrategy.sortArtifacts(ResolutionStrategy.SortOrder.DEPENDENCY_FIRST)
}
create("grammarKitClasspath")
}

dependencies {
Expand All @@ -74,7 +75,7 @@ allprojects {
exclude("org.jetbrains.kotlin")
}
testImplementation("org.assertj:assertj-core:3.24.2")
implementation("it.unimi.dsi:fastutil:8.5.12")
"grammarKitClasspath"("it.unimi.dsi:fastutil:8.5.12")

intellijPlatform {
create(platformType, platformVersion)
Expand Down Expand Up @@ -206,16 +207,22 @@ project(":") {
purgeOldFiles.set(true)
}

// Ensure fastutil is available for grammar-kit tasks
// fastutil is needed by GrammarKit but must not be in implementation — it conflicts with the
// platform's bundled version at test runtime, causing NoSuchMethodError in every test.
tasks.withType<GenerateParserTask> {
classpath = configurations.compileClasspath.get()
classpath = configurations.compileClasspath.get() + configurations["grammarKitClasspath"]
}

tasks.withType<KotlinCompile> {
dependsOn(
generateRegoLexer,
generateRegoParser
)
compilerOptions {
// prevents Kotlin from generating bridge stubs for interface default methods,
// which the plugin verifier flags as deprecated API overrides
freeCompilerArgs.add("-jvm-default=no-compatibility")
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ kotlin.code.style=official
# platformType=IU # IntelliJ IDEA Ultimate
# platformType=PY # PyCharm
platformType=IU
platformVersion=2025.3.1
platformVersion=2026.1.2
# if you update the version of IDE, also change psiViewerPluginVersion
# https://plugins.jetbrains.com/plugin/227-psiviewer/versions
psiViewerPluginVersion=253.7181

# see https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for more information
sinceBuild=252
untilBuild=253.*
sinceBuild=253
untilBuild=261.*

# these two variables will be overwritten by the release process (i.e. the GitHub action) thanks to the env variables:
# - ORG_GRADLE_PROJECT_publishToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fun getPackageAsString(document: Document, project: Project): String {
val file = document.virtualFile ?: return ""
val fileView = PsiManager.getInstance(project).findViewProvider(file) ?: return ""
val psiTree = fileView.getPsi(RegoLanguage)
val children = psiTree.children
val children = psiTree!!.children
for (child in children) {
if (child is RegoPackage) {
return child.ref.text
Expand All @@ -65,7 +65,7 @@ fun getImportsAsString(document: Document, project: Project): MutableList<String
val file = document.virtualFile ?: return mutableListOf<String>()
val fileView = PsiManager.getInstance(project).findViewProvider(file) ?: return mutableListOf<String>()
val psiTree = fileView.getPsi(RegoLanguage)
val children = psiTree.children
val children = psiTree!!.children
var imports = mutableListOf<String>()
for (child in children) {
if (child is RegoImport) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class OPAActionToolWindow {

//if the tool window currently has a console view with the same opa task
//in it, remove the old console before creating a new one
val existing = toolWindow.contentManager.findContent(title) ?: null
val existing = toolWindow.contentManager.findContent(title)
if (existing != null) {
toolWindow.contentManager.removeContent(existing, true)
}
Expand All @@ -131,7 +131,7 @@ class OPAActionToolWindow {
val consoleContent = ContentImpl(consoleView.component, title, false)

//the tool window shouldn't have two consoles with the sdame title (task)
val existing = toolWindow.contentManager.findContent(title) ?: null
val existing = toolWindow.contentManager.findContent(title)
if (existing != null) {
toolWindow.contentManager.removeContent(existing, true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package org.openpolicyagent.ideaplugin.ide.runconfig.ui

import com.intellij.execution.configuration.EnvironmentVariablesComponent
import com.intellij.openapi.fileChooser.FileChooserDescriptor
import com.intellij.openapi.fileChooser.FileTypeDescriptor
import com.intellij.openapi.options.SettingsEditor
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.ProjectRootManager
Expand All @@ -31,10 +30,10 @@ class OpaEvalRunCommandEditor(private val project: Project) : SettingsEditor<Opa
private var input = TextFieldWithBrowseButton().apply {
addBrowseFolderListener(
TextBrowseFolderListener(
FileTypeDescriptor("opa input file", ".json")
FileChooserDescriptor(true, false, false, false, false, false)
.withFileFilter { it.extension == "json" }
)
)

}
private var bundle = TextFieldWithBrowseButton().apply {
addBrowseFolderListener(
Expand Down Expand Up @@ -94,4 +93,4 @@ class OpaEvalRunCommandEditor(private val project: Project) : SettingsEditor<Opa
private fun String.toPath(): Path? {
return nullize()?.let { Paths.get(it) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import com.intellij.execution.process.CapturingProcessHandler
import com.intellij.execution.process.ProcessListener
import com.intellij.execution.process.ProcessOutput
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.runReadAction
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.util.Computable
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.progress.ProgressManager
Expand Down Expand Up @@ -61,14 +62,14 @@ fun GeneralCommandLine.execute(
handler.destroyProcess()
}

val alreadyDisposed = runReadAction {
val alreadyDisposed = ApplicationManager.getApplication().runReadAction(Computable {
try {
Disposer.register(owner, cargoKiller)
false
} catch (e: IncorrectOperationException) {
true
}
}
})

if (alreadyDisposed) {
// On the one hand, this seems fishy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import com.intellij.execution.ExecutionResult
import com.intellij.execution.configuration.EnvironmentVariablesData
import com.intellij.execution.configurations.RunConfiguration
import com.intellij.execution.executors.DefaultRunExecutor
import com.intellij.execution.process.ProcessAdapter
import com.intellij.execution.process.ProcessEvent
import com.intellij.execution.process.ProcessListener
import com.intellij.execution.process.ProcessOutput
import com.intellij.execution.process.ProcessOutputTypes
import com.intellij.execution.runners.ExecutionEnvironmentBuilder
Expand Down Expand Up @@ -78,7 +78,7 @@ abstract class RunConfigurationTestBase : OpaWithRealProjectTestBase() {
/**
* this class has been borrowed from IntelliJ rust plugin
*/
class AnsiAwareCapturingProcessAdapter : ProcessAdapter() {
class AnsiAwareCapturingProcessAdapter : ProcessListener {
val output = ProcessOutput()

override fun onTextAvailable(event: ProcessEvent, outputType: Key<*>) =
Expand All @@ -88,7 +88,6 @@ class AnsiAwareCapturingProcessAdapter : ProcessAdapter() {
output.appendStdout(event.text)
}


override fun processTerminated(event: ProcessEvent) {
output.exitCode = event.exitCode
}
Expand Down
Loading