mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-07 05:34:02 +02:00
Use null instead of -1 when the version of IdeaVim is not set
This commit is contained in:
parent
4fc2c1e04c
commit
62ed920363
src/main/java/com/maddyhome/idea/vim
@ -19,11 +19,7 @@ internal class VimState {
|
||||
var isIdeaJoinNotified by StateProperty("idea-join")
|
||||
var isIdeaPutNotified by StateProperty("idea-put")
|
||||
var wasSubscribedToEAPAutomatically by StateProperty("was-automatically-subscribed-to-eap")
|
||||
|
||||
/**
|
||||
* First logged version of IdeaVim, or "-1" if no version logged
|
||||
*/
|
||||
var firstIdeaVimVersion: String by StringProperty("first-ideavim-version", "-1")
|
||||
var firstIdeaVimVersion: String? by StringProperty("first-ideavim-version", null)
|
||||
|
||||
fun readData(element: Element) {
|
||||
val notifications = element.getChild("notifications")
|
||||
@ -57,7 +53,7 @@ internal class VimState {
|
||||
}
|
||||
|
||||
private val map by lazy { mutableMapOf<String, Boolean>() }
|
||||
private val stringMap by lazy { mutableMapOf<String, String>() }
|
||||
private val stringMap by lazy { mutableMapOf<String, String?>() }
|
||||
|
||||
private class StateProperty(val xmlName: String) : ReadWriteProperty<VimState, Boolean> {
|
||||
|
||||
@ -72,16 +68,17 @@ private class StateProperty(val xmlName: String) : ReadWriteProperty<VimState, B
|
||||
}
|
||||
}
|
||||
|
||||
private class StringProperty(val propertyName: String, val defaultValue: String) : ReadWriteProperty<VimState, String> {
|
||||
private class StringProperty(val propertyName: String, val defaultValue: String?) : ReadWriteProperty<VimState, String?> {
|
||||
|
||||
init {
|
||||
stringMap[propertyName] = defaultValue
|
||||
}
|
||||
|
||||
override fun getValue(thisRef: VimState, property: KProperty<*>): String =
|
||||
stringMap.getOrPut(propertyName) { defaultValue }
|
||||
override fun getValue(thisRef: VimState, property: KProperty<*>): String? {
|
||||
return stringMap.getOrPut(propertyName) { defaultValue }
|
||||
}
|
||||
|
||||
override fun setValue(thisRef: VimState, property: KProperty<*>, value: String) {
|
||||
override fun setValue(thisRef: VimState, property: KProperty<*>, value: String?) {
|
||||
stringMap[propertyName] = value
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ internal class IjVimEnabler : VimEnabler {
|
||||
|
||||
fun ideOpened() {
|
||||
val myFirstVersion = VimPlugin.getVimState().firstIdeaVimVersion
|
||||
if (myFirstVersion == "-1") {
|
||||
if (myFirstVersion == null) {
|
||||
VimPlugin.getVimState().firstIdeaVimVersion = VimPlugin.getVersion()
|
||||
this.isNewUser = true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user