diff --git a/CHANGELOG.md b/CHANGELOG.md index 208d12cd..bea3dde4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- Update dependency versions [[#538](https://github.com/koxudaxi/ruff-pycharm-plugin/pull/538)] ## [0.0.42] - 2024-11-10 diff --git a/build.gradle.kts b/build.gradle.kts index abc94512..c945736b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -36,14 +36,15 @@ dependencies { intellijPlatform { val type = properties("platformType") val version = properties("platformVersion") - val bundledPlugins = properties("platformBundledPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } + val bundledPlugins = + properties("platformBundledPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } create(type, version, useInstaller = false) bundledPlugins(bundledPlugins) val lsp4ij = libs.plugins.lsp4ij.get() plugin("${lsp4ij.pluginId}:${lsp4ij.version.requiredVersion}") - instrumentationTools() testFramework(TestFrameworkType.Bundled) + testFramework(TestFrameworkType.Platform) pluginVerifier() zipSigner() } @@ -68,11 +69,11 @@ intellijPlatform { untilBuild = properties("pluginUntilBuild") } - description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map { + description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map { val start = "" val end = "" - with (it.lines()) { + with(it.lines()) { if (!containsAll(listOf(start, end))) { throw GradleException("Plugin description section not found in README.md:\n$start ... $end") } @@ -91,7 +92,7 @@ intellijPlatform { } } - verifyPlugin { + pluginVerification { ides { recommended() } @@ -112,19 +113,18 @@ intellijPlatform { } -// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin +// Configure Gradle Qodana Plugin - read more: https://www.jetbrains.com/help/qodana/qodana-gradle-plugin.html#qodana+%7B+%7D+extension+configuration qodana { cachePath = provider { file(".qodana").canonicalPath } - reportPath = provider { file("build/reports/inspections").canonicalPath } - saveReport = true - showReport = environment("QODANA_SHOW_REPORT").map { it.toBoolean() }.getOrElse(false) } // Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration -koverReport { - defaults { - xml { - onCheck = true +kover { + reports { + total { + xml { + onCheck = true + } } } } diff --git a/gradle.properties b/gradle.properties index 9b3abad9..2e9413a9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,12 +7,12 @@ pluginRepositoryUrl = https://github.com/koxudaxi/ruff-pycharm-plugin pluginVersion = 0.0.42 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html -pluginSinceBuild = 242.20224.89 +pluginSinceBuild = 243.* pluginUntilBuild = 243.* # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension platformType = PY -platformVersion = 243-EAP-SNAPSHOT +platformVersion = 2024.3.1 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bb4fe0d9..a855ef9b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,20 +1,18 @@ [versions] # libraries -annotations = "24.1.0" tuweni = "2.3.1" ini4j = "0.5.4" -kotlinxSerialization = "1.6.3" +kotlinxSerialization = "1.7.3" # plugins -kotlin = "1.9.23" +kotlin = "2.1.0" changelog = "2.2.1" -gradleIntelliJPlugin = "2.0.1" -qodana = "0.1.13" -kover = "0.7.6" -lsp4ij = "0.5.0" +gradleIntelliJPlugin = "2.2.1" +qodana = "2024.3.4" +kover = "0.9.1" +lsp4ij = "0.9.0" [libraries] -annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" } tuweni = { group = "org.apache.tuweni", name = "tuweni-toml", version.ref = "tuweni" } ini4j = { group = "org.ini4j", name = "ini4j", version.ref = "ini4j" } kotlinxSerialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerialization" } diff --git a/src/com/koxudaxi/ruff/RuffConfigPanel.kt b/src/com/koxudaxi/ruff/RuffConfigPanel.kt index 8d13c83d..69447d31 100644 --- a/src/com/koxudaxi/ruff/RuffConfigPanel.kt +++ b/src/com/koxudaxi/ruff/RuffConfigPanel.kt @@ -63,14 +63,15 @@ class RuffConfigPanel(project: Project) { useLsp4ijRadioButton.isSelected = ruffConfigService.useLsp4ij useRuffFormatCheckBox.isEnabled = true useRuffFormatCheckBox.isSelected = ruffConfigService.useRuffFormat - useRuffServerRadioButton.isEnabled = lspSupported + useRuffServerRadioButton.isEnabled = lspSupported useRuffServerRadioButton.isSelected = ruffConfigService.useRuffServer || !ruffConfigService.useRuffLsp disableOnSaveOutsideOfProjectCheckBox.isSelected = ruffConfigService.disableOnSaveOutsideOfProject enableLspCheckBox.isEnabled = lspSupported enableLspCheckBox.isSelected = ruffConfigService.enableLsp lsp4ijLinkLabel.addMouseListener(object : MouseAdapter() { override fun mouseClicked(e: MouseEvent?) { - ShowSettingsUtil.getInstance().showSettingsDialog(project, PluginManagerConfigurable::class.java, + ShowSettingsUtil.getInstance().showSettingsDialog( + project, PluginManagerConfigurable::class.java, { c -> c.openMarketplaceTab("com.redhat.devtools.lsp4ij") }) } }) @@ -79,9 +80,10 @@ class RuffConfigPanel(project: Project) { } globalRuffExecutablePathField.apply { - addBrowseFolderListener(null, null, null, FileChooserDescriptorFactory.createSingleFileDescriptor()) + addBrowseFolderListener(null, FileChooserDescriptorFactory.createSingleFileDescriptor()) if (textField is JBTextField) { - when (val globalRuffExecutablePath = ruffConfigService.globalRuffExecutablePath?.takeIf { File(it).exists() }) { + when (val globalRuffExecutablePath = + ruffConfigService.globalRuffExecutablePath?.takeIf { File(it).exists() }) { is String -> textField.text = globalRuffExecutablePath else -> setAutodetectedRuff() } @@ -90,9 +92,10 @@ class RuffConfigPanel(project: Project) { } globalRuffLspExecutablePathField.apply { - addBrowseFolderListener(null, null, null, FileChooserDescriptorFactory.createSingleFileDescriptor()) + addBrowseFolderListener(null, FileChooserDescriptorFactory.createSingleFileDescriptor()) if (textField is JBTextField) { - when (val globalRuffLspExecutablePath = ruffConfigService.globalRuffLspExecutablePath?.takeIf { File(it).exists() }) { + when (val globalRuffLspExecutablePath = + ruffConfigService.globalRuffLspExecutablePath?.takeIf { File(it).exists() }) { is String -> textField.text = globalRuffLspExecutablePath else -> setAutodetectedRuffLsp() } @@ -124,7 +127,9 @@ class RuffConfigPanel(project: Project) { } updateLspFields() alwaysUseGlobalRuffCheckBox.addActionListener { updateProjectExecutableFields() } - when (val projectRuffExecutablePath = ruffCacheService.getProjectRuffExecutablePath()?.takeIf { File(it).exists() } ?: getProjectRuffExecutablePath(project, false)) { + when (val projectRuffExecutablePath = + ruffCacheService.getProjectRuffExecutablePath()?.takeIf { File(it).exists() } + ?: getProjectRuffExecutablePath(project, false)) { is String -> projectRuffExecutablePathField.text = projectRuffExecutablePath else -> { projectRuffExecutablePathField.text = "" @@ -133,7 +138,9 @@ class RuffConfigPanel(project: Project) { } - when (val projectRuffLspExecutablePath = ruffCacheService.getProjectRuffLspExecutablePath()?.takeIf { File(it).exists() } ?: getProjectRuffExecutablePath(project, true)) { + when (val projectRuffLspExecutablePath = + ruffCacheService.getProjectRuffLspExecutablePath()?.takeIf { File(it).exists() } + ?: getProjectRuffExecutablePath(project, true)) { is String -> projectRuffLspExecutablePathField.text = projectRuffLspExecutablePath else -> { projectRuffLspExecutablePathField.text = "" @@ -142,7 +149,7 @@ class RuffConfigPanel(project: Project) { } ruffConfigPathField.apply { - addBrowseFolderListener(null, null, null, FileChooserDescriptorFactory.createSingleFileDescriptor()) + addBrowseFolderListener(null, FileChooserDescriptorFactory.createSingleFileDescriptor()) textField.isEditable = false textField.text = ruffConfigService.ruffConfigPath } @@ -150,15 +157,17 @@ class RuffConfigPanel(project: Project) { ruffConfigPathField.text = "" } } + private fun updateLspClientCheckBoxes() { val useLspClient = useRuffLspRadioButton.isSelected || useRuffServerRadioButton.isSelected useIntellijLspClientRadioButton.isEnabled = useLspClient && intellijLspClientSupported useLsp4ijRadioButton.isEnabled = useLspClient && lsp4ijSupported } + private fun updateLspFields() { if (enableLspCheckBox.isSelected) { useLsp4ijRadioButton.isEnabled = lsp4ijSupported - useIntellijLspClientRadioButton.isEnabled = intellijLspClientSupported + useIntellijLspClientRadioButton.isEnabled = intellijLspClientSupported useRuffLspRadioButton.isEnabled = lspSupported useRuffServerRadioButton.isEnabled = lspSupported } else { @@ -170,6 +179,7 @@ class RuffConfigPanel(project: Project) { useRuffServerRadioButton.isEnabled = false } } + private fun updateLspExecutableFields() { val enabled = intellijLspClientSupported && useRuffLspRadioButton.isSelected globalRuffLspExecutablePathField.isEnabled = enabled @@ -180,6 +190,7 @@ class RuffConfigPanel(project: Project) { projectRuffLspLabel.isEnabled = enabled } } + private fun updateProjectExecutableFields() { val enabled = !alwaysUseGlobalRuffCheckBox.isSelected projectRuffExecutablePathField.isEnabled = enabled @@ -189,6 +200,7 @@ class RuffConfigPanel(project: Project) { projectRuffLspLabel.isEnabled = enabled } } + private fun setAutodetectedRuff() = when (val ruffExecutablePath = findGlobalRuffExecutable(false)?.absolutePath) { is String -> globalRuffExecutablePathField.text = ruffExecutablePath @@ -208,8 +220,9 @@ class RuffConfigPanel(project: Project) { } private fun getProjectRuffExecutablePath(project: Project, lsp: Boolean): String? { - return project.pythonSdk?.let { findRuffExecutableInSDK(it, lsp) }?.absolutePath + return project.pythonSdk?.let { findRuffExecutableInSDK(it, lsp) }?.absolutePath } + val runRuffOnSave: Boolean get() = runRuffOnSaveCheckBox.isSelected val runRuffOnReformatCode: Boolean @@ -241,7 +254,7 @@ class RuffConfigPanel(project: Project) { get() = enableLspCheckBox.isSelected companion object { - const val RUFF_EXECUTABLE_NOT_FOUND = "Ruff executable not found" - const val RUFF_LSP_EXECUTABLE_NOT_FOUND = "Ruff-lsp executable not found" + const val RUFF_EXECUTABLE_NOT_FOUND = "Ruff executable not found" + const val RUFF_LSP_EXECUTABLE_NOT_FOUND = "Ruff-lsp executable not found" } } \ No newline at end of file diff --git a/testSrc/com/jetbrains/python/fixtures/PyLightProjectDescriptor.kt b/testSrc/com/jetbrains/python/fixtures/PyLightProjectDescriptor.kt index d856338e..13494598 100644 --- a/testSrc/com/jetbrains/python/fixtures/PyLightProjectDescriptor.kt +++ b/testSrc/com/jetbrains/python/fixtures/PyLightProjectDescriptor.kt @@ -15,7 +15,6 @@ */ package com.jetbrains.python.fixtures -import com.intellij.testFramework.LightProjectDescriptor import com.intellij.openapi.projectRoots.Sdk import com.jetbrains.python.PythonMockSdk import com.intellij.openapi.vfs.VirtualFile @@ -23,6 +22,7 @@ import com.intellij.openapi.roots.ModifiableRootModel import com.intellij.openapi.vfs.LocalFileSystem import com.intellij.openapi.application.PathManager import com.intellij.openapi.roots.OrderRootType +import com.intellij.testFramework.LightProjectDescriptor import com.jetbrains.python.psi.LanguageLevel /**