-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check new factorio API releases (#22)
- Loading branch information
Showing
9 changed files
with
106 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/kotlin/io/serieznyi/intellij/factorioapicompletion/core/versioning/SemVer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.serieznyi.intellij.factorioapicompletion.core.versioning | ||
|
||
class SemVer(): Comparable<SemVer> { | ||
private lateinit var rawVersion: String | ||
|
||
constructor(rawVersion: String) : this() { | ||
this.rawVersion = checkRawVersion(rawVersion) | ||
} | ||
|
||
override operator fun compareTo(other: SemVer): Int { | ||
val thisVersion = com.intellij.util.text.SemVer.parseFromText(rawVersion) | ||
val otherVersion = com.intellij.util.text.SemVer.parseFromText(other.rawVersion) | ||
|
||
return thisVersion!!.compareTo(otherVersion) | ||
} | ||
|
||
override fun toString(): String { | ||
return this.rawVersion | ||
} | ||
|
||
companion object { | ||
fun checkRawVersion(rawVersion: String): String { | ||
if (!isValid(rawVersion)) { | ||
throw IllegalArgumentException("Wrong version") | ||
} | ||
|
||
return rawVersion | ||
} | ||
|
||
fun isValid(rawVersion: String): Boolean { | ||
val semVer = com.intellij.util.text.SemVer.parseFromText(rawVersion) | ||
|
||
return semVer != null | ||
} | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
...otlin/io/serieznyi/intellij/factorioapicompletion/intellij/FactorioApiCompletionBundle.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.serieznyi.intellij.factorioapicompletion.intellij | ||
|
||
import com.intellij.DynamicBundle | ||
import org.jetbrains.annotations.NotNull | ||
import org.jetbrains.annotations.PropertyKey | ||
|
||
|
||
class FactorioApiCompletionBundle() : DynamicBundle(BUNDLE_FILE) { | ||
fun message( | ||
@NotNull @PropertyKey(resourceBundle = BUNDLE_FILE) key: String, | ||
@NotNull vararg params: Any | ||
): String { | ||
return INSTANCE.getMessage(key, params) | ||
} | ||
|
||
companion object { | ||
private const val BUNDLE_FILE = "FactorioApiCompletion" | ||
val INSTANCE = FactorioApiCompletionBundle() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pluginName=Factorio Api Completion | ||
ui.settings.enable=&Enable | ||
supportedApiVersions.min=1.1.100 | ||
supportedApiVersions.max=1.1.107 | ||
ui.settings.reload=Reload | ||
ui.settings.selectApiVersionLabel=Select Factorio API version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters