Skip to content

Commit f8d87fb

Browse files
committed
Merge branch 'dev' into 2024.1
2 parents 7093a23 + dcf7e99 commit f8d87fb

File tree

34 files changed

+133
-68
lines changed

34 files changed

+133
-68
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ body:
3535
- Sponge
3636
- Architectury
3737
- Minecraft Forge
38+
- NeoForge
3839
- Fabric
3940
- Velocity
4041
- Mixins
@@ -46,4 +47,4 @@ body:
4647
id: description
4748
attributes:
4849
label: Description of the bug
49-
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.
50+
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.

.github/ISSUE_TEMPLATE/project_wizard_outdated.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ body:
3434
- Sponge
3535
- Architectury
3636
- Minecraft Forge
37+
- NeoForge
3738
- Fabric
3839
- Velocity
3940
- BungeeCord

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
echo "GRADLE_USER_HOME=$HOME/.gradle" >> "$GITHUB_ENV"
4040
echo "mcdev.deploy.token=${JETBRAINS_TOKEN}" > ~/.gradle/gradle.properties
4141
- name: Publish plugin
42-
run: ./gradlew clean publishPlugin --no-daemon --stacktrace
42+
run: ./gradlew clean :publishPlugin --no-daemon --stacktrace
4343
- name: Get tag name
4444
id: get_tag
4545
shell: bash

build.gradle.kts

-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ plugins {
3434
`mcdev-publishing`
3535
}
3636

37-
val ideaVersionName: String by project
3837
val coreVersion: String by project
3938

4039
val gradleToolingExtension: Configuration by configurations.creating
@@ -43,7 +42,6 @@ val testLibs: Configuration by configurations.creating {
4342
}
4443

4544
group = "com.demonwav.mcdev"
46-
version = "$ideaVersionName-$coreVersion"
4745

4846
val gradleToolingExtensionSourceSet: SourceSet = sourceSets.create("gradle-tooling-extension") {
4947
configurations.named(compileOnlyConfigurationName) {

buildSrc/src/main/kotlin/mcdev-core.gradle.kts

+12-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ plugins {
3232
id("org.cadixdev.licenser")
3333
}
3434

35+
val ideaVersionName: String by project
36+
val coreVersion: String by project
37+
val buildNumber: String? by project
38+
39+
version = "$ideaVersionName-$coreVersion"
40+
41+
// Build numbers are used for nightlies
42+
if (buildNumber != null) {
43+
version = "$version-$buildNumber"
44+
}
45+
3546
java {
3647
toolchain {
3748
languageVersion.set(JavaLanguageVersion.of(17))
@@ -99,7 +110,7 @@ dependencies {
99110
}
100111

101112
testImplementation(libs.junit.api)
102-
testCompileOnly(libs.junit.vintage) // Hack to get tests to compile and run
113+
testImplementation(libs.junit.vintage) // Hack to get tests to compile and run
103114
testRuntimeOnly(libs.junit.engine)
104115
testRuntimeOnly(libs.junit.platform.launcher)
105116
}

buildSrc/src/main/kotlin/mcdev-publishing.gradle.kts

-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ plugins {
2323
}
2424

2525
tasks.publishPlugin {
26-
// Build numbers are used for nightlies
27-
properties["buildNumber"]?.let { buildNumber ->
28-
project.version = "${project.version}-$buildNumber"
29-
}
3026
properties["mcdev.deploy.token"]?.let { deployToken ->
3127
token.set(deployToken.toString())
3228
}

changelog.md

+15
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
### Added
66

77
- `plugin.yml`, `paper-plugin.yml` and `bungee.yml` main class reference and validity inspection
8+
- `mods.toml` and `neoforge.mods.toml` documentation for lookup elements
9+
- Support for split strings within inspections and method target references in Mixins ([#2358](https://github.com/minecraft-dev/MinecraftDev/pull/2358))
10+
- Mouse ungrab on breakpoint hit while running a Gradle task
11+
12+
### Changed
13+
14+
- More reliable ClassFqn creator property suggestions and validation
15+
- Lang spellchecking now works in dumb mode
16+
17+
### Fixed
18+
19+
- [#2362](https://github.com/minecraft-dev/MinecraftDev/issues/2362) CME in fabric.mod.json
20+
- Ignored annotations registrations
21+
- NeoGradle and NeoModDev Minecraft version import
22+
- [#2360](https://github.com/minecraft-dev/MinecraftDev/issues/2360) `Class initialization must not depend on services` error
823

924
## [1.8.1] - 2024-08-10
1025

gradle/libs.versions.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ asm = "9.6"
77
fuel = "2.3.1"
88
licenser = "0.6.1"
99
changelog = "2.2.0"
10-
intellij-plugin = "2.0.1"
10+
intellij-plugin = "2.1.0"
1111
intellij-ide = "2024.1"
1212
idea-ext = "1.1.8"
1313
psiPlugin = "241.14494.158-EAP-SNAPSHOT"

obfuscation-explorer/build.gradle.kts

-4
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,11 @@ plugins {
2626
`mcdev-publishing`
2727
}
2828

29-
val ideaVersionName: String by project
30-
val coreVersion: String by project
31-
3229
val jflex by configurations
3330
val jflexSkeleton by configurations
3431
val grammarKit by configurations
3532

3633
group = "io.mcdev.obfex"
37-
version = "$ideaVersionName-$coreVersion"
3834

3935
intellijPlatform {
4036
projectName = "Obfuscation Explorer"

src/main/kotlin/facet/MinecraftLibraryKinds.kt

+18-16
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,21 @@ import com.demonwav.mcdev.platform.neoforge.framework.NEOFORGE_LIBRARY_KIND
3535
import com.demonwav.mcdev.platform.sponge.framework.SPONGE_LIBRARY_KIND
3636
import com.demonwav.mcdev.platform.velocity.framework.VELOCITY_LIBRARY_KIND
3737

38-
val MINECRAFT_LIBRARY_KINDS = setOf(
39-
BUKKIT_LIBRARY_KIND,
40-
SPIGOT_LIBRARY_KIND,
41-
PAPER_LIBRARY_KIND,
42-
SPONGE_LIBRARY_KIND,
43-
FORGE_LIBRARY_KIND,
44-
NEOFORGE_LIBRARY_KIND,
45-
FABRIC_LIBRARY_KIND,
46-
ARCHITECTURY_LIBRARY_KIND,
47-
MCP_LIBRARY_KIND,
48-
MIXIN_LIBRARY_KIND,
49-
BUNGEECORD_LIBRARY_KIND,
50-
WATERFALL_LIBRARY_KIND,
51-
VELOCITY_LIBRARY_KIND,
52-
ADVENTURE_LIBRARY_KIND,
53-
)
38+
val MINECRAFT_LIBRARY_KINDS by lazy {
39+
setOf(
40+
BUKKIT_LIBRARY_KIND,
41+
SPIGOT_LIBRARY_KIND,
42+
PAPER_LIBRARY_KIND,
43+
SPONGE_LIBRARY_KIND,
44+
FORGE_LIBRARY_KIND,
45+
NEOFORGE_LIBRARY_KIND,
46+
FABRIC_LIBRARY_KIND,
47+
ARCHITECTURY_LIBRARY_KIND,
48+
MCP_LIBRARY_KIND,
49+
MIXIN_LIBRARY_KIND,
50+
BUNGEECORD_LIBRARY_KIND,
51+
WATERFALL_LIBRARY_KIND,
52+
VELOCITY_LIBRARY_KIND,
53+
ADVENTURE_LIBRARY_KIND,
54+
)
55+
}

src/main/kotlin/insight/generation/GenerateEventListenerHandler.kt

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import com.demonwav.mcdev.util.mapFirstNotNull
2828
import com.intellij.codeInsight.CodeInsightActionHandler
2929
import com.intellij.ide.util.TreeClassChooserFactory
3030
import com.intellij.openapi.editor.Editor
31+
import com.intellij.openapi.editor.EditorModificationUtil
3132
import com.intellij.openapi.project.Project
3233
import com.intellij.psi.PsiClass
3334
import com.intellij.psi.PsiFile
@@ -43,6 +44,10 @@ class GenerateEventListenerHandler : CodeInsightActionHandler {
4344
val caretElement = file.findElementAt(editor.caretModel.offset) ?: return
4445
val context = caretElement.context ?: return
4546

47+
if (!EditorModificationUtil.requestWriting(editor)) {
48+
return
49+
}
50+
4651
val chooser = TreeClassChooserFactory.getInstance(project)
4752
.createWithInnerClassesScopeChooser(
4853
RefactoringBundle.message("choose.destination.class"),

src/main/kotlin/platform/adventure/framework/AdventureLibraryKind.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.adventure.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val ADVENTURE_LIBRARY_KIND: LibraryKind = libraryKind("adventure-api")
26+
val ADVENTURE_LIBRARY_KIND: LibraryKind by libraryKind("adventure-api")

src/main/kotlin/platform/architectury/framework/ArchitecturyLibraryKind.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.architectury.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val ARCHITECTURY_LIBRARY_KIND: LibraryKind = libraryKind("architectury-api")
26+
val ARCHITECTURY_LIBRARY_KIND: LibraryKind by libraryKind("architectury-api")

src/main/kotlin/platform/bukkit/framework/BukkitLibraryKind.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ package com.demonwav.mcdev.platform.bukkit.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val BUKKIT_LIBRARY_KIND: LibraryKind = libraryKind("bukkit-api")
27-
val SPIGOT_LIBRARY_KIND: LibraryKind = libraryKind("spigot-api")
28-
val PAPER_LIBRARY_KIND: LibraryKind = libraryKind("paper-api")
26+
val BUKKIT_LIBRARY_KIND: LibraryKind by libraryKind("bukkit-api")
27+
val SPIGOT_LIBRARY_KIND: LibraryKind by libraryKind("spigot-api")
28+
val PAPER_LIBRARY_KIND: LibraryKind by libraryKind("paper-api")

src/main/kotlin/platform/bungeecord/framework/BungeeCordLibraryKind.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ package com.demonwav.mcdev.platform.bungeecord.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val BUNGEECORD_LIBRARY_KIND: LibraryKind = libraryKind("bungeecord-api")
27-
val WATERFALL_LIBRARY_KIND: LibraryKind = libraryKind("waterfall-api")
26+
val BUNGEECORD_LIBRARY_KIND: LibraryKind by libraryKind("bungeecord-api")
27+
val WATERFALL_LIBRARY_KIND: LibraryKind by libraryKind("waterfall-api")

src/main/kotlin/platform/fabric/framework/FabricLibraryKind.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.fabric.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val FABRIC_LIBRARY_KIND: LibraryKind = libraryKind("fabric-library")
26+
val FABRIC_LIBRARY_KIND: LibraryKind by libraryKind("fabric-library")

src/main/kotlin/platform/forge/framework/ForgeLibraryKind.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.forge.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val FORGE_LIBRARY_KIND: LibraryKind = libraryKind("forge-library")
26+
val FORGE_LIBRARY_KIND: LibraryKind by libraryKind("forge-library")

src/main/kotlin/platform/mcp/framework/McpLibraryKind.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.mcp.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val MCP_LIBRARY_KIND: LibraryKind = libraryKind("mcp-library")
26+
val MCP_LIBRARY_KIND: LibraryKind by libraryKind("mcp-library")

src/main/kotlin/platform/mixin/MixinModule.kt

+12-7
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import com.demonwav.mcdev.util.nullable
3131
import com.intellij.json.psi.JsonFile
3232
import com.intellij.json.psi.JsonObject
3333
import com.intellij.openapi.fileTypes.FileTypeManager
34-
import com.intellij.openapi.fileTypes.FileTypes
3534
import com.intellij.openapi.project.Project
3635
import com.intellij.psi.JavaPsiFacade
3736
import com.intellij.psi.PsiClass
@@ -54,19 +53,24 @@ class MixinModule(facet: MinecraftFacet) : AbstractModule(facet) {
5453
override val icon: Icon? = null
5554

5655
companion object {
57-
private val mixinFileType by lazy {
58-
FileTypeManager.getInstance().findFileTypeByName("Mixin Configuration") ?: FileTypes.UNKNOWN
56+
private val mixinFileTypes by lazy {
57+
listOfNotNull(
58+
FileTypeManager.getInstance().findFileTypeByName("Mixin Json Configuration"),
59+
FileTypeManager.getInstance().findFileTypeByName("Mixin Json5 Configuration")
60+
)
5961
}
6062

6163
fun getMixinConfigs(
6264
project: Project,
6365
scope: GlobalSearchScope,
6466
): Collection<MixinConfig> {
65-
return FileTypeIndex.getFiles(mixinFileType, scope)
66-
.mapNotNull {
67-
(PsiManager.getInstance(project).findFile(it) as? JsonFile)?.topLevelValue as? JsonObject
67+
return mixinFileTypes
68+
.flatMap { FileTypeIndex.getFiles(it, scope) }
69+
.mapNotNull { file ->
70+
(PsiManager.getInstance(project).findFile(file) as? JsonFile)?.topLevelValue as? JsonObject
71+
}.map { jsonObject ->
72+
MixinConfig(project, jsonObject)
6873
}
69-
.map { MixinConfig(project, it) }
7074
}
7175

7276
fun getAllMixinClasses(
@@ -93,3 +97,4 @@ class MixinModule(facet: MinecraftFacet) : AbstractModule(facet) {
9397
}
9498
}
9599
}
100+

src/main/kotlin/platform/mixin/config/MixinConfig.kt

+2
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ class MixinConfig(private val project: Project, private var json: JsonObject) {
147147
}
148148

149149
private fun reformat() {
150+
if(json.containingFile.name.endsWith(".json5")) return
151+
150152
json = CodeStyleManager.getInstance(project).reformat(json) as JsonObject
151153
file?.let { file ->
152154
val psiFile = PsiManager.getInstance(project).findFile(file) as? JsonFile ?: return

src/main/kotlin/platform/mixin/config/MixinConfigFileType.kt

+19-6
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,35 @@ package com.demonwav.mcdev.platform.mixin.config
2222

2323
import com.demonwav.mcdev.asset.PlatformAssets
2424
import com.intellij.json.JsonLanguage
25+
import com.intellij.json.json5.Json5Language
2526
import com.intellij.openapi.fileTypes.LanguageFileType
2627
import com.intellij.openapi.fileTypes.ex.FileTypeIdentifiableByVirtualFile
2728
import com.intellij.openapi.vfs.VirtualFile
2829

29-
object MixinConfigFileType : LanguageFileType(JsonLanguage.INSTANCE), FileTypeIdentifiableByVirtualFile {
30-
31-
private val filenameRegex = "(^|\\.)mixins?(\\.[^.]+)*\\.json\$".toRegex()
30+
interface MixinConfigFileType : FileTypeIdentifiableByVirtualFile {
31+
fun getFilenameRegex() : Regex
3232

3333
// Dynamic file type detection is sadly needed as we're overriding the built-in json file type.
3434
// Simply using an extension pattern is not sufficient as there is no way to bump the version to tell
3535
// the cache that the pattern has changed, as it now has, without changing the file type name.
3636
// See https://www.plugin-dev.com/intellij/custom-language/file-type-detection/#guidelines
37-
override fun isMyFileType(file: VirtualFile) = file.name.contains(filenameRegex)
37+
override fun isMyFileType(file: VirtualFile) = file.name.contains(getFilenameRegex())
3838

39-
override fun getName() = "Mixin Configuration"
4039
override fun getDescription() = "Mixin configuration"
4140
override fun getDefaultExtension() = ""
4241
override fun getIcon() = PlatformAssets.MIXIN_ICON
43-
}
42+
43+
object Json : LanguageFileType(JsonLanguage.INSTANCE), MixinConfigFileType {
44+
private val filenameRegex = "(^|\\.)mixins?(\\.[^.]+)*\\.json\$".toRegex()
45+
46+
override fun getFilenameRegex() : Regex = filenameRegex
47+
override fun getName() = "Mixin Json Configuration"
48+
}
49+
50+
object Json5 : LanguageFileType(Json5Language.INSTANCE), MixinConfigFileType {
51+
private var filenameRegex = "(^|\\.)mixins?(\\.[^.]+)*\\.json5\$".toRegex()
52+
53+
override fun getFilenameRegex() : Regex = filenameRegex
54+
override fun getName() = "Mixin Json5 Configuration"
55+
}
56+
}

src/main/kotlin/platform/mixin/config/MixinConfigImportOptimizer.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class MixinConfigImportOptimizer : ImportOptimizer {
8181
}
8282
}
8383

84-
override fun supports(file: PsiFile) = file is JsonFile && file.fileType == MixinConfigFileType
84+
override fun supports(file: PsiFile) = file is JsonFile && file.fileType is MixinConfigFileType
8585

8686
override fun processFile(file: PsiFile): Runnable {
8787
if (file !is JsonFile) {

src/main/kotlin/platform/mixin/config/inspection/MixinConfigInspection.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ abstract class MixinConfigInspection : LocalInspectionTool() {
3434
protected abstract fun buildVisitor(holder: ProblemsHolder): PsiElementVisitor
3535

3636
private fun checkFile(file: PsiFile): Boolean {
37-
return file.fileType === MixinConfigFileType && MixinModuleType.isInModule(file)
37+
return file.fileType is MixinConfigFileType && MixinModuleType.isInModule(file)
3838
}
3939

4040
final override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {

src/main/kotlin/platform/mixin/config/reference/MixinConfigReferenceContributor.kt

+7-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,14 @@ import com.intellij.psi.PsiReferenceContributor
3131
import com.intellij.psi.PsiReferenceRegistrar
3232

3333
class MixinConfigReferenceContributor : PsiReferenceContributor() {
34-
3534
override fun registerReferenceProviders(registrar: PsiReferenceRegistrar) {
35+
val anyMixinConfigFileType = StandardPatterns.or(
36+
StandardPatterns.`object`(MixinConfigFileType.Json),
37+
StandardPatterns.`object`(MixinConfigFileType.Json5)
38+
)
39+
3640
val pattern = PlatformPatterns.psiElement(JsonStringLiteral::class.java)
37-
.inFile(PlatformPatterns.psiFile().withFileType(StandardPatterns.`object`(MixinConfigFileType)))
41+
.inFile(PlatformPatterns.psiFile().withFileType(anyMixinConfigFileType))
3842

3943
registrar.registerReferenceProvider(pattern.isPropertyKey(), ConfigProperty)
4044
registrar.registerReferenceProvider(pattern.isPropertyValue("package"), MixinPackage)
@@ -47,3 +51,4 @@ class MixinConfigReferenceContributor : PsiReferenceContributor() {
4751
registrar.registerReferenceProvider(pattern.withParent(mixinList.isPropertyValue("client")), MixinClass)
4852
}
4953
}
54+

src/main/kotlin/platform/mixin/framework/MixinLibraryKind.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.mixin.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val MIXIN_LIBRARY_KIND: LibraryKind = libraryKind("mixin-library")
26+
val MIXIN_LIBRARY_KIND: LibraryKind by libraryKind("mixin-library")

src/main/kotlin/platform/neoforge/framework/NeoForgeLibraryKind.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.neoforge.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val NEOFORGE_LIBRARY_KIND: LibraryKind = libraryKind("neoforge-library")
26+
val NEOFORGE_LIBRARY_KIND: LibraryKind by libraryKind("neoforge-library")

src/main/kotlin/platform/sponge/framework/SpongeLibraryKind.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.sponge.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val SPONGE_LIBRARY_KIND: LibraryKind = libraryKind("sponge-api")
26+
val SPONGE_LIBRARY_KIND: LibraryKind by libraryKind("sponge-api")

src/main/kotlin/platform/velocity/framework/VelocityLibraryKind.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.velocity.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val VELOCITY_LIBRARY_KIND: LibraryKind = libraryKind("velocity-api")
26+
val VELOCITY_LIBRARY_KIND: LibraryKind by libraryKind("velocity-api")

0 commit comments

Comments
 (0)