Skip to content

Commit 71a16cb

Browse files
committed
Updates for 2023.1.
1 parent 57e093d commit 71a16cb

File tree

9 files changed

+58
-55
lines changed

9 files changed

+58
-55
lines changed

build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ fun properties(key: String) = project.findProperty(key).toString()
33
plugins {
44
id("java")
55
id("maven-publish")
6-
id("org.jetbrains.kotlin.jvm") version "1.7.21"
7-
id("org.jetbrains.intellij") version "1.11.0"
8-
id("com.github.blueboxware.tocme") version "1.3"
6+
id("org.jetbrains.kotlin.jvm") version "1.8.10"
7+
id("org.jetbrains.intellij") version "1.13.0"
8+
id("com.github.blueboxware.tocme") version "1.7"
99
}
1010

1111
group = properties("pluginGroup")
@@ -55,7 +55,7 @@ tasks {
5555
}
5656

5757
runIde {
58-
maxHeapSize = "2g"
58+
maxHeapSize = "8g"
5959
systemProperties = mapOf(
6060
"idea.ProcessCanceledException" to "disabled"
6161
)

gradle.properties

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ pluginGroup = com.gmail.blueboxware
22
pluginName = LibGDX Plugin
33
pluginVersion = 1.24.2
44

5-
pluginSinceBuild = 223.8214.52
5+
pluginSinceBuild = 231.7665.28
66
pluginUntilBuild =
77

8-
# See https://jb.gg/intellij-platform-builds-list for available build versions.
9-
pluginVerifierIdeVersions = 223.8214.52
8+
# See https://www.jetbrains.com/intellij-repository/snapshots/ for available build versions.
9+
pluginVerifierIdeVersions = 231.7665.28
1010

1111
platformType = IC
12-
platformVersion = 223.8214.52
12+
#platformVersion = 223.8214.52
13+
platformVersion = 231.7665.28-EAP-SNAPSHOT
1314
platformDownloadSources = true
1415

1516
platformPlugins = java, Kotlin, Groovy, properties

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/LibGDXStartupActivity.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.gmail.blueboxware.libgdxplugin.filetypes.skin.refactoring.ChangeKotli
44
import com.gmail.blueboxware.libgdxplugin.versions.VersionService
55
import com.intellij.openapi.components.service
66
import com.intellij.openapi.project.Project
7-
import com.intellij.openapi.startup.StartupActivity
7+
import com.intellij.openapi.startup.ProjectActivity
88
import com.intellij.psi.PsiManager
99

1010

@@ -23,9 +23,9 @@ import com.intellij.psi.PsiManager
2323
* See the License for the specific language governing permissions and
2424
* limitations under the License.
2525
*/
26-
class LibGDXStartupActivity : StartupActivity.DumbAware {
26+
class LibGDXStartupActivity : ProjectActivity {
2727

28-
override fun runActivity(project: Project) {
28+
override suspend fun execute(project: Project) {
2929
PsiManager.getInstance(project).addPsiTreeChangeListener(
3030
ChangeKotlinPackageListener(project),
3131
project.service<DisposableProvider>()
@@ -34,4 +34,5 @@ class LibGDXStartupActivity : StartupActivity.DumbAware {
3434
project.service<VersionService>().projectOpened()
3535
}
3636

37+
3738
}

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/filetypes/skin/editor/SkinCompletionContributor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ class SkinCompletionContributor : CompletionContributor() {
331331

332332
}
333333

334-
} else if (elementType == PsiType.BOOLEAN || elementClassName == "java.lang.Boolean") {
334+
} else if (elementType == PsiTypes.booleanType() || elementClassName == "java.lang.Boolean") {
335335
doAdd(LookupElementBuilder.create("true"), parameters, result)
336336
doAdd(LookupElementBuilder.create("false"), parameters, result)
337337
}

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/filetypes/skin/inspections/SkinNonExistingResourceAliasInspection.kt

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,44 +27,45 @@ class SkinNonExistingResourceAliasInspection : SkinBaseInspection() {
2727

2828
override fun getStaticDescription() = message("skin.inspection.non.existing.resource.alias.description")
2929

30-
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean) =
31-
object : SkinElementVisitor() {
30+
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean) = object : SkinElementVisitor() {
3231

33-
override fun visitStringLiteral(stringLiteral: SkinStringLiteral) {
32+
override fun visitStringLiteral(stringLiteral: SkinStringLiteral) {
3433

35-
if (stringLiteral.parent is SkinPropertyName
36-
|| stringLiteral.parent is SkinClassName
37-
|| stringLiteral.parent is SkinResourceName
38-
) {
39-
return
40-
}
41-
42-
val reference = stringLiteral.reference
34+
if (stringLiteral.parent is SkinPropertyName || stringLiteral.parent is SkinClassName || stringLiteral.parent is SkinResourceName) {
35+
return
36+
}
4337

44-
if (reference is SkinResourceReference) {
45-
val referent = reference.resolve()
46-
if (referent == null) {
47-
val quickfix = stringLiteral.resolveToClass()?.let { clazz ->
38+
val reference = stringLiteral.reference
4839

49-
if (clazz.qualifiedName == "java.lang.String") {
50-
null
51-
} else if (clazz.qualifiedName == TINTED_DRAWABLE_CLASS_NAME && stringLiteral.context is SkinResource) {
52-
null
53-
} else {
54-
CreateAssetQuickFix(stringLiteral, stringLiteral.value, DollarClassName(clazz))
55-
}
40+
if (reference is SkinResourceReference) {
41+
val referent = reference.resolve()
42+
if (referent == null) {
43+
val quickfix = stringLiteral.resolveToClass()?.let { clazz ->
5644

45+
if (clazz.qualifiedName == "java.lang.String") {
46+
null
47+
} else if (clazz.qualifiedName == TINTED_DRAWABLE_CLASS_NAME && stringLiteral.context is SkinResource) {
48+
null
49+
} else {
50+
CreateAssetQuickFix(stringLiteral, stringLiteral.value, DollarClassName(clazz))
5751
}
58-
holder.registerProblem(
59-
stringLiteral,
60-
message("skin.inspection.non.existing.resource.alias.message", stringLiteral.value),
61-
quickfix
62-
)
52+
6353
}
64-
}
54+
if (quickfix != null) holder.registerProblem(
55+
stringLiteral,
56+
message("skin.inspection.non.existing.resource.alias.message", stringLiteral.value),
57+
quickfix
58+
)
59+
else holder.registerProblem(
60+
stringLiteral,
61+
message("skin.inspection.non.existing.resource.alias.message", stringLiteral.value)
62+
)
6563

64+
}
6665
}
6766

6867
}
6968

69+
}
70+
7071
}

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/filetypes/skin/inspections/SkinTypeInspection.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import com.intellij.codeInspection.ProblemsHolder
88
import com.intellij.psi.PsiClassType
99
import com.intellij.psi.PsiElementVisitor
1010
import com.intellij.psi.PsiPrimitiveType
11-
import com.intellij.psi.PsiType
11+
import com.intellij.psi.PsiTypes
1212

1313
/*
1414
* Copyright 2017 Blue Box Ware
@@ -54,18 +54,18 @@ class SkinTypeInspection : SkinBaseInspection() {
5454
if (skinValue !is SkinArray) {
5555
problem("Array")
5656
}
57-
} else if (expectedType == PsiType.BOOLEAN) {
57+
} else if (expectedType == PsiTypes.booleanType()) {
5858
if (!skinValue.isBoolean) {
5959
problem("boolean")
6060
}
6161
} else if (expectedType is PsiPrimitiveType) {
6262
val check = when (expectedType) {
63-
PsiType.BYTE -> skinValue.text.toByteOrNull() != null
64-
PsiType.DOUBLE -> skinValue.text.toDoubleOrNull() != null
65-
PsiType.FLOAT -> skinValue.text.toFloatOrNull() != null
66-
PsiType.INT -> skinValue.text.toIntOrNull() != null
67-
PsiType.LONG -> skinValue.text.toLongOrNull() != null
68-
PsiType.SHORT -> skinValue.text.toShortOrNull() != null
63+
PsiTypes.byteType() -> skinValue.text.toByteOrNull() != null
64+
PsiTypes.doubleType() -> skinValue.text.toDoubleOrNull() != null
65+
PsiTypes.floatType() -> skinValue.text.toFloatOrNull() != null
66+
PsiTypes.intType() -> skinValue.text.toIntOrNull() != null
67+
PsiTypes.longType() -> skinValue.text.toLongOrNull() != null
68+
PsiTypes.shortType() -> skinValue.text.toShortOrNull() != null
6969
else -> true
7070
}
7171
if (!check) {

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/utils/ColorPsiElementsUtils.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private fun PsiElement.findColor(isSpecialColorMethod: Boolean): Color? = getCac
204204
val types = initialValue.argumentList?.expressionTypes ?: return@getCachedValue null
205205
val argument1type = types.firstOrNull() ?: return@getCachedValue null
206206

207-
if (arguments.size == 1 && argument1type == PsiType.INT) {
207+
if (arguments.size == 1 && argument1type == PsiTypes.intType()) {
208208
// new Color(int)
209209
arguments.firstOrNull()?.let { expr ->
210210
val arg = expr.findRoot()
@@ -278,11 +278,11 @@ private fun PsiElement.findColor(isSpecialColorMethod: Boolean): Color? = getCac
278278
val floats = arrayOf(0f, 0f, 0f, 0f)
279279
for (i in 0..3) {
280280
arguments[i]?.let { expr ->
281-
@Suppress("CascadeIf") if (expr.type == PsiType.FLOAT) {
281+
@Suppress("CascadeIf") if (expr.type == PsiTypes.floatType()) {
282282
val root = expr.findRoot()
283283
val float = root.psiFloat() ?: return@getCachedValue null
284284
floats[i] = float
285-
} else if (expr.type == PsiType.INT) {
285+
} else if (expr.type == PsiTypes.intType()) {
286286
val arg = expr.findRoot()
287287
val int = arg.javaInt() ?: return@getCachedValue null
288288
floats[i] = int.toFloat()
@@ -476,7 +476,7 @@ private fun PsiElement.ktInt(): Int? {
476476

477477
private fun PsiElement.javaInt(): Long? {
478478

479-
if (this is PsiExpression && type == PsiType.INT) {
479+
if (this is PsiExpression && type == PsiTypes.intType()) {
480480

481481
try {
482482
return if (text.startsWith("0x")) {

src/test/kotlin/com/gmail/blueboxware/libgdxplugin/TestVersionHandlingLocalhost.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import java.util.*
3838
@Suppress("ReplaceNotNullAssertionWithElvisReturn")
3939
class TestVersionHandlingLocalhost : LibGDXCodeInsightFixtureTestCase() {
4040

41-
private val RUN_TESTS = true
41+
private val RUN_TESTS = false
4242

4343
private lateinit var versionService: VersionService
4444

src/test/testdata/filetypes/skin/inspections/nonExistingResourceAliasInspection.skin

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
com.example.ColorArrayHolder: {
6868
a: {
6969
colors: [red, <warning descr="'pink' does not refer to anything. Resources must be defined before they can be used.">pink</warning>],
70-
moreColors: [<warning descr="'pink' does not refer to anything. Resources must be defined before they can be used.">pink</warning>, [<warning descr="'pink' does not refer to anything. Resources must be defined before they can be used.">pink</warning>, yellow]],
70+
moreColors: [<warning descr="'purple' does not refer to anything. Resources must be defined before they can be used.">purple</warning>, [<warning descr="'pink' does not refer to anything. Resources must be defined before they can be used.">pink</warning>, yellow]],
7171
m: [
7272
{
7373
buttonStyle: yes
@@ -165,4 +165,4 @@
165165
bar: foo
166166
error: <warning descr="'error' does not refer to anything. Resources must be defined before they can be used.">error</warning>
167167
}
168-
}
168+
}

0 commit comments

Comments
 (0)