diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 27074ddfd..b46a452eb 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -35,6 +35,7 @@ body: - Sponge - Architectury - Minecraft Forge + - NeoForge - Fabric - Velocity - Mixins @@ -46,4 +47,4 @@ body: id: description attributes: label: Description of the bug - description: Always include a stack trace if there is one. Otherwise, the more information you can provide in terms of how to reproduce the problem, the more likely it'll be fixed. If there is something specific about your project, a link to the GitHub project can be very helpful. \ No newline at end of file + description: Always include a stack trace if there is one. Otherwise, the more information you can provide in terms of how to reproduce the problem, the more likely it'll be fixed. If there is something specific about your project, a link to the GitHub project can be very helpful. diff --git a/.github/ISSUE_TEMPLATE/project_wizard_outdated.yaml b/.github/ISSUE_TEMPLATE/project_wizard_outdated.yaml index 520839fb3..67588b53d 100644 --- a/.github/ISSUE_TEMPLATE/project_wizard_outdated.yaml +++ b/.github/ISSUE_TEMPLATE/project_wizard_outdated.yaml @@ -34,6 +34,7 @@ body: - Sponge - Architectury - Minecraft Forge + - NeoForge - Fabric - Velocity - BungeeCord diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b0908e67e..b86642140 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -39,7 +39,7 @@ jobs: echo "GRADLE_USER_HOME=$HOME/.gradle" >> "$GITHUB_ENV" echo "mcdev.deploy.token=${JETBRAINS_TOKEN}" > ~/.gradle/gradle.properties - name: Publish plugin - run: ./gradlew clean publishPlugin --no-daemon --stacktrace + run: ./gradlew clean :publishPlugin --no-daemon --stacktrace - name: Get tag name id: get_tag shell: bash diff --git a/build.gradle.kts b/build.gradle.kts index a40c11c36..bcf5fb098 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,6 @@ plugins { `mcdev-publishing` } -val ideaVersionName: String by project val coreVersion: String by project val gradleToolingExtension: Configuration by configurations.creating @@ -43,7 +42,6 @@ val testLibs: Configuration by configurations.creating { } group = "com.demonwav.mcdev" -version = "$ideaVersionName-$coreVersion" val gradleToolingExtensionSourceSet: SourceSet = sourceSets.create("gradle-tooling-extension") { configurations.named(compileOnlyConfigurationName) { diff --git a/buildSrc/src/main/kotlin/mcdev-core.gradle.kts b/buildSrc/src/main/kotlin/mcdev-core.gradle.kts index 2d078447d..818cc4241 100644 --- a/buildSrc/src/main/kotlin/mcdev-core.gradle.kts +++ b/buildSrc/src/main/kotlin/mcdev-core.gradle.kts @@ -32,6 +32,17 @@ plugins { id("org.cadixdev.licenser") } +val ideaVersionName: String by project +val coreVersion: String by project +val buildNumber: String? by project + +version = "$ideaVersionName-$coreVersion" + +// Build numbers are used for nightlies +if (buildNumber != null) { + version = "$version-$buildNumber" +} + java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) @@ -99,7 +110,7 @@ dependencies { } testImplementation(libs.junit.api) - testCompileOnly(libs.junit.vintage) // Hack to get tests to compile and run + testImplementation(libs.junit.vintage) // Hack to get tests to compile and run testRuntimeOnly(libs.junit.engine) testRuntimeOnly(libs.junit.platform.launcher) } diff --git a/buildSrc/src/main/kotlin/mcdev-publishing.gradle.kts b/buildSrc/src/main/kotlin/mcdev-publishing.gradle.kts index e2854c071..bf78cced5 100644 --- a/buildSrc/src/main/kotlin/mcdev-publishing.gradle.kts +++ b/buildSrc/src/main/kotlin/mcdev-publishing.gradle.kts @@ -23,10 +23,6 @@ plugins { } tasks.publishPlugin { - // Build numbers are used for nightlies - properties["buildNumber"]?.let { buildNumber -> - project.version = "${project.version}-$buildNumber" - } properties["mcdev.deploy.token"]?.let { deployToken -> token.set(deployToken.toString()) } diff --git a/changelog.md b/changelog.md index 00f5aa55e..074e38d07 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,21 @@ ### Added - `plugin.yml`, `paper-plugin.yml` and `bungee.yml` main class reference and validity inspection +- `mods.toml` and `neoforge.mods.toml` documentation for lookup elements +- Support for split strings within inspections and method target references in Mixins ([#2358](https://github.com/minecraft-dev/MinecraftDev/pull/2358)) +- Mouse ungrab on breakpoint hit while running a Gradle task + +### Changed + +- More reliable ClassFqn creator property suggestions and validation +- Lang spellchecking now works in dumb mode + +### Fixed + +- [#2362](https://github.com/minecraft-dev/MinecraftDev/issues/2362) CME in fabric.mod.json +- Ignored annotations registrations +- NeoGradle and NeoModDev Minecraft version import +- [#2360](https://github.com/minecraft-dev/MinecraftDev/issues/2360) `Class initialization must not depend on services` error ## [1.8.1] - 2024-08-10 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dfecc9a1b..6e1b9a06b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ asm = "9.6" fuel = "2.3.1" licenser = "0.6.1" changelog = "2.2.0" -intellij-plugin = "2.0.1" +intellij-plugin = "2.1.0" intellij-ide = "2024.1" idea-ext = "1.1.8" psiPlugin = "241.14494.158-EAP-SNAPSHOT" diff --git a/obfuscation-explorer/build.gradle.kts b/obfuscation-explorer/build.gradle.kts index 62517b9f2..fd4a10a33 100644 --- a/obfuscation-explorer/build.gradle.kts +++ b/obfuscation-explorer/build.gradle.kts @@ -26,15 +26,11 @@ plugins { `mcdev-publishing` } -val ideaVersionName: String by project -val coreVersion: String by project - val jflex by configurations val jflexSkeleton by configurations val grammarKit by configurations group = "io.mcdev.obfex" -version = "$ideaVersionName-$coreVersion" intellijPlatform { projectName = "Obfuscation Explorer" diff --git a/src/main/kotlin/facet/MinecraftLibraryKinds.kt b/src/main/kotlin/facet/MinecraftLibraryKinds.kt index 3fcabd438..0b7ec1853 100644 --- a/src/main/kotlin/facet/MinecraftLibraryKinds.kt +++ b/src/main/kotlin/facet/MinecraftLibraryKinds.kt @@ -35,19 +35,21 @@ import com.demonwav.mcdev.platform.neoforge.framework.NEOFORGE_LIBRARY_KIND import com.demonwav.mcdev.platform.sponge.framework.SPONGE_LIBRARY_KIND import com.demonwav.mcdev.platform.velocity.framework.VELOCITY_LIBRARY_KIND -val MINECRAFT_LIBRARY_KINDS = setOf( - BUKKIT_LIBRARY_KIND, - SPIGOT_LIBRARY_KIND, - PAPER_LIBRARY_KIND, - SPONGE_LIBRARY_KIND, - FORGE_LIBRARY_KIND, - NEOFORGE_LIBRARY_KIND, - FABRIC_LIBRARY_KIND, - ARCHITECTURY_LIBRARY_KIND, - MCP_LIBRARY_KIND, - MIXIN_LIBRARY_KIND, - BUNGEECORD_LIBRARY_KIND, - WATERFALL_LIBRARY_KIND, - VELOCITY_LIBRARY_KIND, - ADVENTURE_LIBRARY_KIND, -) +val MINECRAFT_LIBRARY_KINDS by lazy { + setOf( + BUKKIT_LIBRARY_KIND, + SPIGOT_LIBRARY_KIND, + PAPER_LIBRARY_KIND, + SPONGE_LIBRARY_KIND, + FORGE_LIBRARY_KIND, + NEOFORGE_LIBRARY_KIND, + FABRIC_LIBRARY_KIND, + ARCHITECTURY_LIBRARY_KIND, + MCP_LIBRARY_KIND, + MIXIN_LIBRARY_KIND, + BUNGEECORD_LIBRARY_KIND, + WATERFALL_LIBRARY_KIND, + VELOCITY_LIBRARY_KIND, + ADVENTURE_LIBRARY_KIND, + ) +} diff --git a/src/main/kotlin/insight/generation/GenerateEventListenerHandler.kt b/src/main/kotlin/insight/generation/GenerateEventListenerHandler.kt index cfd8e45a7..9cdf39495 100644 --- a/src/main/kotlin/insight/generation/GenerateEventListenerHandler.kt +++ b/src/main/kotlin/insight/generation/GenerateEventListenerHandler.kt @@ -28,6 +28,7 @@ import com.demonwav.mcdev.util.mapFirstNotNull import com.intellij.codeInsight.CodeInsightActionHandler import com.intellij.ide.util.TreeClassChooserFactory import com.intellij.openapi.editor.Editor +import com.intellij.openapi.editor.EditorModificationUtil import com.intellij.openapi.project.Project import com.intellij.psi.PsiClass import com.intellij.psi.PsiFile @@ -43,6 +44,10 @@ class GenerateEventListenerHandler : CodeInsightActionHandler { val caretElement = file.findElementAt(editor.caretModel.offset) ?: return val context = caretElement.context ?: return + if (!EditorModificationUtil.requestWriting(editor)) { + return + } + val chooser = TreeClassChooserFactory.getInstance(project) .createWithInnerClassesScopeChooser( RefactoringBundle.message("choose.destination.class"), diff --git a/src/main/kotlin/platform/adventure/framework/AdventureLibraryKind.kt b/src/main/kotlin/platform/adventure/framework/AdventureLibraryKind.kt index 322d58ae1..4deb1b346 100644 --- a/src/main/kotlin/platform/adventure/framework/AdventureLibraryKind.kt +++ b/src/main/kotlin/platform/adventure/framework/AdventureLibraryKind.kt @@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.adventure.framework import com.demonwav.mcdev.util.libraryKind import com.intellij.openapi.roots.libraries.LibraryKind -val ADVENTURE_LIBRARY_KIND: LibraryKind = libraryKind("adventure-api") +val ADVENTURE_LIBRARY_KIND: LibraryKind by libraryKind("adventure-api") diff --git a/src/main/kotlin/platform/architectury/framework/ArchitecturyLibraryKind.kt b/src/main/kotlin/platform/architectury/framework/ArchitecturyLibraryKind.kt index bec0e8653..af8a87321 100644 --- a/src/main/kotlin/platform/architectury/framework/ArchitecturyLibraryKind.kt +++ b/src/main/kotlin/platform/architectury/framework/ArchitecturyLibraryKind.kt @@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.architectury.framework import com.demonwav.mcdev.util.libraryKind import com.intellij.openapi.roots.libraries.LibraryKind -val ARCHITECTURY_LIBRARY_KIND: LibraryKind = libraryKind("architectury-api") +val ARCHITECTURY_LIBRARY_KIND: LibraryKind by libraryKind("architectury-api") diff --git a/src/main/kotlin/platform/bukkit/framework/BukkitLibraryKind.kt b/src/main/kotlin/platform/bukkit/framework/BukkitLibraryKind.kt index 2ee4a2b60..0434e6ab3 100644 --- a/src/main/kotlin/platform/bukkit/framework/BukkitLibraryKind.kt +++ b/src/main/kotlin/platform/bukkit/framework/BukkitLibraryKind.kt @@ -23,6 +23,6 @@ package com.demonwav.mcdev.platform.bukkit.framework import com.demonwav.mcdev.util.libraryKind import com.intellij.openapi.roots.libraries.LibraryKind -val BUKKIT_LIBRARY_KIND: LibraryKind = libraryKind("bukkit-api") -val SPIGOT_LIBRARY_KIND: LibraryKind = libraryKind("spigot-api") -val PAPER_LIBRARY_KIND: LibraryKind = libraryKind("paper-api") +val BUKKIT_LIBRARY_KIND: LibraryKind by libraryKind("bukkit-api") +val SPIGOT_LIBRARY_KIND: LibraryKind by libraryKind("spigot-api") +val PAPER_LIBRARY_KIND: LibraryKind by libraryKind("paper-api") diff --git a/src/main/kotlin/platform/bungeecord/framework/BungeeCordLibraryKind.kt b/src/main/kotlin/platform/bungeecord/framework/BungeeCordLibraryKind.kt index 2ad5c6845..b9d684827 100644 --- a/src/main/kotlin/platform/bungeecord/framework/BungeeCordLibraryKind.kt +++ b/src/main/kotlin/platform/bungeecord/framework/BungeeCordLibraryKind.kt @@ -23,5 +23,5 @@ package com.demonwav.mcdev.platform.bungeecord.framework import com.demonwav.mcdev.util.libraryKind import com.intellij.openapi.roots.libraries.LibraryKind -val BUNGEECORD_LIBRARY_KIND: LibraryKind = libraryKind("bungeecord-api") -val WATERFALL_LIBRARY_KIND: LibraryKind = libraryKind("waterfall-api") +val BUNGEECORD_LIBRARY_KIND: LibraryKind by libraryKind("bungeecord-api") +val WATERFALL_LIBRARY_KIND: LibraryKind by libraryKind("waterfall-api") diff --git a/src/main/kotlin/platform/fabric/framework/FabricLibraryKind.kt b/src/main/kotlin/platform/fabric/framework/FabricLibraryKind.kt index af976c80b..7b3cec3b6 100644 --- a/src/main/kotlin/platform/fabric/framework/FabricLibraryKind.kt +++ b/src/main/kotlin/platform/fabric/framework/FabricLibraryKind.kt @@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.fabric.framework import com.demonwav.mcdev.util.libraryKind import com.intellij.openapi.roots.libraries.LibraryKind -val FABRIC_LIBRARY_KIND: LibraryKind = libraryKind("fabric-library") +val FABRIC_LIBRARY_KIND: LibraryKind by libraryKind("fabric-library") diff --git a/src/main/kotlin/platform/forge/framework/ForgeLibraryKind.kt b/src/main/kotlin/platform/forge/framework/ForgeLibraryKind.kt index 65222cbfc..6252adc93 100644 --- a/src/main/kotlin/platform/forge/framework/ForgeLibraryKind.kt +++ b/src/main/kotlin/platform/forge/framework/ForgeLibraryKind.kt @@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.forge.framework import com.demonwav.mcdev.util.libraryKind import com.intellij.openapi.roots.libraries.LibraryKind -val FORGE_LIBRARY_KIND: LibraryKind = libraryKind("forge-library") +val FORGE_LIBRARY_KIND: LibraryKind by libraryKind("forge-library") diff --git a/src/main/kotlin/platform/mcp/framework/McpLibraryKind.kt b/src/main/kotlin/platform/mcp/framework/McpLibraryKind.kt index 209f8fb79..ce6e001c5 100644 --- a/src/main/kotlin/platform/mcp/framework/McpLibraryKind.kt +++ b/src/main/kotlin/platform/mcp/framework/McpLibraryKind.kt @@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.mcp.framework import com.demonwav.mcdev.util.libraryKind import com.intellij.openapi.roots.libraries.LibraryKind -val MCP_LIBRARY_KIND: LibraryKind = libraryKind("mcp-library") +val MCP_LIBRARY_KIND: LibraryKind by libraryKind("mcp-library") diff --git a/src/main/kotlin/platform/mixin/MixinModule.kt b/src/main/kotlin/platform/mixin/MixinModule.kt index 5deebfbf2..1ac235176 100644 --- a/src/main/kotlin/platform/mixin/MixinModule.kt +++ b/src/main/kotlin/platform/mixin/MixinModule.kt @@ -31,7 +31,6 @@ import com.demonwav.mcdev.util.nullable import com.intellij.json.psi.JsonFile import com.intellij.json.psi.JsonObject import com.intellij.openapi.fileTypes.FileTypeManager -import com.intellij.openapi.fileTypes.FileTypes import com.intellij.openapi.project.Project import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiClass @@ -54,19 +53,24 @@ class MixinModule(facet: MinecraftFacet) : AbstractModule(facet) { override val icon: Icon? = null companion object { - private val mixinFileType by lazy { - FileTypeManager.getInstance().findFileTypeByName("Mixin Configuration") ?: FileTypes.UNKNOWN + private val mixinFileTypes by lazy { + listOfNotNull( + FileTypeManager.getInstance().findFileTypeByName("Mixin Json Configuration"), + FileTypeManager.getInstance().findFileTypeByName("Mixin Json5 Configuration") + ) } fun getMixinConfigs( project: Project, scope: GlobalSearchScope, ): Collection { - return FileTypeIndex.getFiles(mixinFileType, scope) - .mapNotNull { - (PsiManager.getInstance(project).findFile(it) as? JsonFile)?.topLevelValue as? JsonObject + return mixinFileTypes + .flatMap { FileTypeIndex.getFiles(it, scope) } + .mapNotNull { file -> + (PsiManager.getInstance(project).findFile(file) as? JsonFile)?.topLevelValue as? JsonObject + }.map { jsonObject -> + MixinConfig(project, jsonObject) } - .map { MixinConfig(project, it) } } fun getAllMixinClasses( @@ -93,3 +97,4 @@ class MixinModule(facet: MinecraftFacet) : AbstractModule(facet) { } } } + diff --git a/src/main/kotlin/platform/mixin/config/MixinConfig.kt b/src/main/kotlin/platform/mixin/config/MixinConfig.kt index bb84274f1..2adda4812 100644 --- a/src/main/kotlin/platform/mixin/config/MixinConfig.kt +++ b/src/main/kotlin/platform/mixin/config/MixinConfig.kt @@ -147,6 +147,8 @@ class MixinConfig(private val project: Project, private var json: JsonObject) { } private fun reformat() { + if(json.containingFile.name.endsWith(".json5")) return + json = CodeStyleManager.getInstance(project).reformat(json) as JsonObject file?.let { file -> val psiFile = PsiManager.getInstance(project).findFile(file) as? JsonFile ?: return diff --git a/src/main/kotlin/platform/mixin/config/MixinConfigFileType.kt b/src/main/kotlin/platform/mixin/config/MixinConfigFileType.kt index bd37ac5dd..a6cfb647c 100644 --- a/src/main/kotlin/platform/mixin/config/MixinConfigFileType.kt +++ b/src/main/kotlin/platform/mixin/config/MixinConfigFileType.kt @@ -22,22 +22,35 @@ package com.demonwav.mcdev.platform.mixin.config import com.demonwav.mcdev.asset.PlatformAssets import com.intellij.json.JsonLanguage +import com.intellij.json.json5.Json5Language import com.intellij.openapi.fileTypes.LanguageFileType import com.intellij.openapi.fileTypes.ex.FileTypeIdentifiableByVirtualFile import com.intellij.openapi.vfs.VirtualFile -object MixinConfigFileType : LanguageFileType(JsonLanguage.INSTANCE), FileTypeIdentifiableByVirtualFile { - - private val filenameRegex = "(^|\\.)mixins?(\\.[^.]+)*\\.json\$".toRegex() +interface MixinConfigFileType : FileTypeIdentifiableByVirtualFile { + fun getFilenameRegex() : Regex // Dynamic file type detection is sadly needed as we're overriding the built-in json file type. // Simply using an extension pattern is not sufficient as there is no way to bump the version to tell // the cache that the pattern has changed, as it now has, without changing the file type name. // See https://www.plugin-dev.com/intellij/custom-language/file-type-detection/#guidelines - override fun isMyFileType(file: VirtualFile) = file.name.contains(filenameRegex) + override fun isMyFileType(file: VirtualFile) = file.name.contains(getFilenameRegex()) - override fun getName() = "Mixin Configuration" override fun getDescription() = "Mixin configuration" override fun getDefaultExtension() = "" override fun getIcon() = PlatformAssets.MIXIN_ICON -} + + object Json : LanguageFileType(JsonLanguage.INSTANCE), MixinConfigFileType { + private val filenameRegex = "(^|\\.)mixins?(\\.[^.]+)*\\.json\$".toRegex() + + override fun getFilenameRegex() : Regex = filenameRegex + override fun getName() = "Mixin Json Configuration" + } + + object Json5 : LanguageFileType(Json5Language.INSTANCE), MixinConfigFileType { + private var filenameRegex = "(^|\\.)mixins?(\\.[^.]+)*\\.json5\$".toRegex() + + override fun getFilenameRegex() : Regex = filenameRegex + override fun getName() = "Mixin Json5 Configuration" + } +} \ No newline at end of file diff --git a/src/main/kotlin/platform/mixin/config/MixinConfigImportOptimizer.kt b/src/main/kotlin/platform/mixin/config/MixinConfigImportOptimizer.kt index 5bb35f5a0..c7f1ca12f 100644 --- a/src/main/kotlin/platform/mixin/config/MixinConfigImportOptimizer.kt +++ b/src/main/kotlin/platform/mixin/config/MixinConfigImportOptimizer.kt @@ -81,7 +81,7 @@ class MixinConfigImportOptimizer : ImportOptimizer { } } - override fun supports(file: PsiFile) = file is JsonFile && file.fileType == MixinConfigFileType + override fun supports(file: PsiFile) = file is JsonFile && file.fileType is MixinConfigFileType override fun processFile(file: PsiFile): Runnable { if (file !is JsonFile) { diff --git a/src/main/kotlin/platform/mixin/config/inspection/MixinConfigInspection.kt b/src/main/kotlin/platform/mixin/config/inspection/MixinConfigInspection.kt index bdeac9bd1..37b4cdd4c 100644 --- a/src/main/kotlin/platform/mixin/config/inspection/MixinConfigInspection.kt +++ b/src/main/kotlin/platform/mixin/config/inspection/MixinConfigInspection.kt @@ -34,7 +34,7 @@ abstract class MixinConfigInspection : LocalInspectionTool() { protected abstract fun buildVisitor(holder: ProblemsHolder): PsiElementVisitor private fun checkFile(file: PsiFile): Boolean { - return file.fileType === MixinConfigFileType && MixinModuleType.isInModule(file) + return file.fileType is MixinConfigFileType && MixinModuleType.isInModule(file) } final override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor { diff --git a/src/main/kotlin/platform/mixin/config/reference/MixinConfigReferenceContributor.kt b/src/main/kotlin/platform/mixin/config/reference/MixinConfigReferenceContributor.kt index 5ffffbdc8..433df566d 100644 --- a/src/main/kotlin/platform/mixin/config/reference/MixinConfigReferenceContributor.kt +++ b/src/main/kotlin/platform/mixin/config/reference/MixinConfigReferenceContributor.kt @@ -31,10 +31,14 @@ import com.intellij.psi.PsiReferenceContributor import com.intellij.psi.PsiReferenceRegistrar class MixinConfigReferenceContributor : PsiReferenceContributor() { - override fun registerReferenceProviders(registrar: PsiReferenceRegistrar) { + val anyMixinConfigFileType = StandardPatterns.or( + StandardPatterns.`object`(MixinConfigFileType.Json), + StandardPatterns.`object`(MixinConfigFileType.Json5) + ) + val pattern = PlatformPatterns.psiElement(JsonStringLiteral::class.java) - .inFile(PlatformPatterns.psiFile().withFileType(StandardPatterns.`object`(MixinConfigFileType))) + .inFile(PlatformPatterns.psiFile().withFileType(anyMixinConfigFileType)) registrar.registerReferenceProvider(pattern.isPropertyKey(), ConfigProperty) registrar.registerReferenceProvider(pattern.isPropertyValue("package"), MixinPackage) @@ -47,3 +51,4 @@ class MixinConfigReferenceContributor : PsiReferenceContributor() { registrar.registerReferenceProvider(pattern.withParent(mixinList.isPropertyValue("client")), MixinClass) } } + diff --git a/src/main/kotlin/platform/mixin/framework/MixinLibraryKind.kt b/src/main/kotlin/platform/mixin/framework/MixinLibraryKind.kt index a2c52861f..82ce3b556 100644 --- a/src/main/kotlin/platform/mixin/framework/MixinLibraryKind.kt +++ b/src/main/kotlin/platform/mixin/framework/MixinLibraryKind.kt @@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.mixin.framework import com.demonwav.mcdev.util.libraryKind import com.intellij.openapi.roots.libraries.LibraryKind -val MIXIN_LIBRARY_KIND: LibraryKind = libraryKind("mixin-library") +val MIXIN_LIBRARY_KIND: LibraryKind by libraryKind("mixin-library") diff --git a/src/main/kotlin/platform/neoforge/framework/NeoForgeLibraryKind.kt b/src/main/kotlin/platform/neoforge/framework/NeoForgeLibraryKind.kt index c57bc00cf..2962f133a 100644 --- a/src/main/kotlin/platform/neoforge/framework/NeoForgeLibraryKind.kt +++ b/src/main/kotlin/platform/neoforge/framework/NeoForgeLibraryKind.kt @@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.neoforge.framework import com.demonwav.mcdev.util.libraryKind import com.intellij.openapi.roots.libraries.LibraryKind -val NEOFORGE_LIBRARY_KIND: LibraryKind = libraryKind("neoforge-library") +val NEOFORGE_LIBRARY_KIND: LibraryKind by libraryKind("neoforge-library") diff --git a/src/main/kotlin/platform/sponge/framework/SpongeLibraryKind.kt b/src/main/kotlin/platform/sponge/framework/SpongeLibraryKind.kt index ffcfd5554..1cd272827 100644 --- a/src/main/kotlin/platform/sponge/framework/SpongeLibraryKind.kt +++ b/src/main/kotlin/platform/sponge/framework/SpongeLibraryKind.kt @@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.sponge.framework import com.demonwav.mcdev.util.libraryKind import com.intellij.openapi.roots.libraries.LibraryKind -val SPONGE_LIBRARY_KIND: LibraryKind = libraryKind("sponge-api") +val SPONGE_LIBRARY_KIND: LibraryKind by libraryKind("sponge-api") diff --git a/src/main/kotlin/platform/velocity/framework/VelocityLibraryKind.kt b/src/main/kotlin/platform/velocity/framework/VelocityLibraryKind.kt index 7b36b2b09..9d297f559 100644 --- a/src/main/kotlin/platform/velocity/framework/VelocityLibraryKind.kt +++ b/src/main/kotlin/platform/velocity/framework/VelocityLibraryKind.kt @@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.velocity.framework import com.demonwav.mcdev.util.libraryKind import com.intellij.openapi.roots.libraries.LibraryKind -val VELOCITY_LIBRARY_KIND: LibraryKind = libraryKind("velocity-api") +val VELOCITY_LIBRARY_KIND: LibraryKind by libraryKind("velocity-api") diff --git a/src/main/kotlin/toml/platform/forge/completion/ModsTomlCompletionContributor.kt b/src/main/kotlin/toml/platform/forge/completion/ModsTomlCompletionContributor.kt index 2045f30ac..b15fb4273 100644 --- a/src/main/kotlin/toml/platform/forge/completion/ModsTomlCompletionContributor.kt +++ b/src/main/kotlin/toml/platform/forge/completion/ModsTomlCompletionContributor.kt @@ -126,7 +126,12 @@ object ModsTomlKeyCompletionProvider : CompletionProvider( result.addAllElements( variants.map { entry -> - LookupElementBuilder.create(entry, entry.key).withInsertHandler(TomlKeyInsertionHandler(keyValue)) + var lookup = LookupElementBuilder.create(entry, entry.key) + .withInsertHandler(TomlKeyInsertionHandler(keyValue)) + if (entry.type != null) { + lookup = lookup.withTypeText(entry.type.presentableName) + } + lookup } ) } diff --git a/src/main/kotlin/translations/lang/spellcheck/LangSpellcheckingStrategy.kt b/src/main/kotlin/translations/lang/spellcheck/LangSpellcheckingStrategy.kt index c952cfced..d966d8527 100644 --- a/src/main/kotlin/translations/lang/spellcheck/LangSpellcheckingStrategy.kt +++ b/src/main/kotlin/translations/lang/spellcheck/LangSpellcheckingStrategy.kt @@ -22,13 +22,14 @@ package com.demonwav.mcdev.translations.lang.spellcheck import com.demonwav.mcdev.translations.lang.MCLangLanguage import com.demonwav.mcdev.translations.lang.gen.psi.LangTypes +import com.intellij.openapi.project.DumbAware import com.intellij.psi.PsiElement import com.intellij.psi.impl.source.tree.LeafPsiElement import com.intellij.spellchecker.tokenizer.SpellcheckingStrategy import com.intellij.spellchecker.tokenizer.Tokenizer import com.intellij.spellchecker.tokenizer.TokenizerBase -class LangSpellcheckingStrategy : SpellcheckingStrategy() { +class LangSpellcheckingStrategy : SpellcheckingStrategy(), DumbAware { private val langCommentTokenizer = LangCommentTokenizer() private val langKeyTokenizer = TokenizerBase(LangKeySplitter) diff --git a/src/main/kotlin/util/utils.kt b/src/main/kotlin/util/utils.kt index 5e7ce939e..cb984ef09 100644 --- a/src/main/kotlin/util/utils.kt +++ b/src/main/kotlin/util/utils.kt @@ -362,7 +362,8 @@ inline fun Iterable<*>.firstOfType(): T? { return this.firstOrNull { it is T } as? T } -fun libraryKind(id: String): LibraryKind = LibraryKindRegistry.getInstance().findKindById(id) ?: LibraryKind.create(id) +fun libraryKind(id: String): Lazy = + lazy { LibraryKindRegistry.getInstance().findKindById(id) ?: LibraryKind.create(id) } fun String.capitalize(): String = replaceFirstChar { diff --git a/src/main/resources/META-INF/toml-support.xml b/src/main/resources/META-INF/mcdev-toml.xml similarity index 100% rename from src/main/resources/META-INF/toml-support.xml rename to src/main/resources/META-INF/mcdev-toml.xml diff --git a/src/main/resources/META-INF/yaml-support.xml b/src/main/resources/META-INF/mcdev-yaml.xml similarity index 100% rename from src/main/resources/META-INF/yaml-support.xml rename to src/main/resources/META-INF/mcdev-yaml.xml diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 0ed01a521..f01c10a05 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -27,8 +27,8 @@ org.intellij.groovy com.intellij.properties ByteCodeViewer - org.toml.lang - org.jetbrains.plugins.yaml + org.toml.lang + org.jetbrains.plugins.yaml com.demonwav.minecraft-dev Minecraft Development @@ -720,14 +720,22 @@ id="Find Mixins"/> - + + + +