Skip to content

Commit 4aee64b

Browse files
committed
Add support for optional boolean in cc_create
1 parent 9b78290 commit 4aee64b

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Add breadcrumbs and sticky lines support
66
- Add support for IntelliJ 2025.
7+
- Add support for optional boolean argument in cc_create
78

89
## [1.7.1] - 2025-01-12
910

src/main/kotlin/io/runescript/plugin/lang/psi/type/inference/CommandHandler.kt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,4 +246,29 @@ data object DumpCommandHandler : CommandHandler {
246246

247247
o.type = RsPrimitiveType.STRING
248248
}
249+
}
250+
251+
data object CcCreateCommandHandler : CommandHandler {
252+
override fun RsTypeInferenceVisitor.inferTypes(
253+
reference: RsScript,
254+
o: RsCommandExpression
255+
) {
256+
val arguments = o.argumentList.expressionList
257+
val parameterTypes = if (arguments.size == 4) {
258+
arrayOf<RsType>(
259+
RsPrimitiveType.COMPONENT,
260+
RsPrimitiveType.INT,
261+
RsPrimitiveType.INT,
262+
RsPrimitiveType.BOOLEAN
263+
)
264+
} else {
265+
arrayOf<RsType>(
266+
RsPrimitiveType.COMPONENT,
267+
RsPrimitiveType.INT,
268+
RsPrimitiveType.INT
269+
)
270+
}
271+
checkArgumentList(o.argumentList, parameterTypes)
272+
o.type = RsUnitType
273+
}
249274
}

src/main/kotlin/io/runescript/plugin/lang/psi/type/inference/RsTypeInferenceVisitor.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ private fun RsScript.findCommandHandler(): CommandHandler {
726726
"db_find_refine_with_count" -> DbFindCommandHandler.DB_FIND_REFINE_WITH_COUNT
727727
"db_getfield" -> DbGetFieldCommandHandler
728728
"dump" -> DumpCommandHandler
729+
"cc_create", ".cc_create" -> CcCreateCommandHandler
729730
else -> DefaultCommandHandler
730731
}
731732
}

0 commit comments

Comments
 (0)