Skip to content

Commit

Permalink
Merge pull request #538 from koxudaxi/update_dependency_versions
Browse files Browse the repository at this point in the history
Update dependency versions
  • Loading branch information
koxudaxi authored Jan 12, 2025
2 parents b3b66fb + 841a5ec commit b0447b9
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 37 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
26 changes: 13 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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 = "<!-- Plugin description -->"
val end = "<!-- Plugin description 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")
}
Expand All @@ -91,7 +92,7 @@ intellijPlatform {
}
}

verifyPlugin {
pluginVerification {
ides {
recommended()
}
Expand All @@ -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
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 6 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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" }
Expand Down
39 changes: 26 additions & 13 deletions src/com/koxudaxi/ruff/RuffConfigPanel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Check warning on line 74 in src/com/koxudaxi/ruff/RuffConfigPanel.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'com.intellij.ide.plugins.PluginManagerConfigurable' is marked unstable with @ApiStatus.Internal
{ c -> c.openMarketplaceTab("com.redhat.devtools.lsp4ij") })

Check notice on line 75 in src/com/koxudaxi/ruff/RuffConfigPanel.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Lambda argument inside parentheses

Lambda argument should be moved out of parentheses

Check warning on line 75 in src/com/koxudaxi/ruff/RuffConfigPanel.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'openMarketplaceTab([email protected] String)' is declared in unstable class 'com.intellij.ide.plugins.PluginManagerConfigurable' marked with @ApiStatus.Internal
}
})
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand Down Expand Up @@ -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 = ""
Expand All @@ -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 = ""
Expand All @@ -142,23 +149,25 @@ class RuffConfigPanel(project: Project) {
}

ruffConfigPathField.apply {
addBrowseFolderListener(null, null, null, FileChooserDescriptorFactory.createSingleFileDescriptor())
addBrowseFolderListener(null, FileChooserDescriptorFactory.createSingleFileDescriptor())
textField.isEditable = false
textField.text = ruffConfigService.ruffConfigPath
}
clearRuffConfigPathButton.addActionListener {
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 {
Expand All @@ -170,6 +179,7 @@ class RuffConfigPanel(project: Project) {
useRuffServerRadioButton.isEnabled = false
}
}

private fun updateLspExecutableFields() {
val enabled = intellijLspClientSupported && useRuffLspRadioButton.isSelected
globalRuffLspExecutablePathField.isEnabled = enabled
Expand All @@ -180,6 +190,7 @@ class RuffConfigPanel(project: Project) {
projectRuffLspLabel.isEnabled = enabled
}
}

private fun updateProjectExecutableFields() {
val enabled = !alwaysUseGlobalRuffCheckBox.isSelected
projectRuffExecutablePathField.isEnabled = enabled
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/
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
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

/**
Expand Down

0 comments on commit b0447b9

Please sign in to comment.