Minor: cleanup org.jetbrains.kotlin.idea package
This commit is contained in:
@@ -173,7 +173,7 @@ class KotlinFoldingBuilder : CustomFoldingBuilder(), DumbAware {
|
|||||||
|
|
||||||
private fun String.addSpaceIfNeeded(): String {
|
private fun String.addSpaceIfNeeded(): String {
|
||||||
if (isEmpty() || endsWith(" ")) return this
|
if (isEmpty() || endsWith(" ")) return this
|
||||||
return this + " "
|
return "$this "
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getFirstLineOfComment(node: ASTNode): String {
|
private fun getFirstLineOfComment(node: ASTNode): String {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ internal data class KotlinPluginVersion(
|
|||||||
val patchNumber: String // usually '1'
|
val patchNumber: String // usually '1'
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
private val KOTLIN_VERSION_REGEX = "^([\\d\\.]+)\\-([A-Za-z]+)\\-(\\d+)\\-([A-Za-z0-9\\.]+)\\-(\\d+)$".toRegex()
|
private val KOTLIN_VERSION_REGEX = "^([\\d.]+)-([A-Za-z]+)-(\\d+)-([A-Za-z0-9.]+)-(\\d+)$".toRegex()
|
||||||
|
|
||||||
fun parse(version: String): KotlinPluginVersion? {
|
fun parse(version: String): KotlinPluginVersion? {
|
||||||
val matchResult = KOTLIN_VERSION_REGEX.matchEntire(version) ?: return null
|
val matchResult = KOTLIN_VERSION_REGEX.matchEntire(version) ?: return null
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ sealed class PluginUpdateStatus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KotlinPluginUpdater(val propertiesComponent: PropertiesComponent) : Disposable {
|
class KotlinPluginUpdater(private val propertiesComponent: PropertiesComponent) : Disposable {
|
||||||
private var updateDelay = INITIAL_UPDATE_DELAY
|
private var updateDelay = INITIAL_UPDATE_DELAY
|
||||||
private val alarm = Alarm(Alarm.ThreadToUse.POOLED_THREAD, this)
|
private val alarm = Alarm(Alarm.ThreadToUse.POOLED_THREAD, this)
|
||||||
private val notificationGroup = NotificationGroup("Kotlin plugin updates", NotificationDisplayType.STICKY_BALLOON, true)
|
private val notificationGroup = NotificationGroup("Kotlin plugin updates", NotificationDisplayType.STICKY_BALLOON, true)
|
||||||
@@ -200,12 +200,10 @@ class KotlinPluginUpdater(val propertiesComponent: PropertiesComponent) : Dispos
|
|||||||
return PluginUpdateStatus.LatestVersionInstalled
|
return PluginUpdateStatus.LatestVersionInstalled
|
||||||
}
|
}
|
||||||
val newVersion = responseDoc.getChild("category")?.getChild("idea-plugin")?.getChild("version")?.text
|
val newVersion = responseDoc.getChild("category")?.getChild("idea-plugin")?.getChild("version")?.text
|
||||||
if (newVersion == null) {
|
?: return PluginUpdateStatus.CheckFailed(
|
||||||
return PluginUpdateStatus.CheckFailed(
|
|
||||||
"Couldn't find plugin version in repository response",
|
"Couldn't find plugin version in repository response",
|
||||||
JDOMUtil.writeElement(responseDoc, "\n")
|
JDOMUtil.writeElement(responseDoc, "\n")
|
||||||
)
|
)
|
||||||
}
|
|
||||||
val pluginDescriptor = initPluginDescriptor(newVersion)
|
val pluginDescriptor = initPluginDescriptor(newVersion)
|
||||||
return updateIfNotLatest(pluginDescriptor, null)
|
return updateIfNotLatest(pluginDescriptor, null)
|
||||||
}
|
}
|
||||||
@@ -274,6 +272,8 @@ class KotlinPluginUpdater(val propertiesComponent: PropertiesComponent) : Dispos
|
|||||||
|
|
||||||
if (prepareResult) {
|
if (prepareResult) {
|
||||||
val pluginDescriptor = pluginDownloader.descriptor
|
val pluginDescriptor = pluginDownloader.descriptor
|
||||||
|
// BUNCH: 181 Not null since 182.
|
||||||
|
@Suppress("SENSELESS_COMPARISON")
|
||||||
if (pluginDescriptor != null) {
|
if (pluginDescriptor != null) {
|
||||||
installed = true
|
installed = true
|
||||||
pluginDownloader.install()
|
pluginDownloader.install()
|
||||||
|
|||||||
Reference in New Issue
Block a user