Minor: cleanup org.jetbrains.kotlin.idea package

This commit is contained in:
Nikolay Krasko
2019-03-06 19:51:45 +03:00
parent 08b93b0ba0
commit 76d4a2fd17
3 changed files with 6 additions and 6 deletions
@@ -173,7 +173,7 @@ class KotlinFoldingBuilder : CustomFoldingBuilder(), DumbAware {
private fun String.addSpaceIfNeeded(): String {
if (isEmpty() || endsWith(" ")) return this
return this + " "
return "$this "
}
private fun getFirstLineOfComment(node: ASTNode): String {
@@ -34,7 +34,7 @@ internal data class KotlinPluginVersion(
val patchNumber: String // usually '1'
) {
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? {
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 val alarm = Alarm(Alarm.ThreadToUse.POOLED_THREAD, this)
private val notificationGroup = NotificationGroup("Kotlin plugin updates", NotificationDisplayType.STICKY_BALLOON, true)
@@ -200,12 +200,10 @@ class KotlinPluginUpdater(val propertiesComponent: PropertiesComponent) : Dispos
return PluginUpdateStatus.LatestVersionInstalled
}
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",
JDOMUtil.writeElement(responseDoc, "\n")
)
}
val pluginDescriptor = initPluginDescriptor(newVersion)
return updateIfNotLatest(pluginDescriptor, null)
}
@@ -274,6 +272,8 @@ class KotlinPluginUpdater(val propertiesComponent: PropertiesComponent) : Dispos
if (prepareResult) {
val pluginDescriptor = pluginDownloader.descriptor
// BUNCH: 181 Not null since 182.
@Suppress("SENSELESS_COMPARISON")
if (pluginDescriptor != null) {
installed = true
pluginDownloader.install()