Skip to content

Commit ea34d05

Browse files
committed
fix: Fix build
1 parent d8d5a4f commit ea34d05

File tree

8 files changed

+14
-46
lines changed

8 files changed

+14
-46
lines changed

build.gradle.kts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
id("java")
33
id("org.jetbrains.grammarkit") version "2022.3.1"
44
id("org.jetbrains.kotlin.jvm") version "1.9.24"
5-
id("org.jetbrains.intellij") version "1.16.1"
5+
id("org.jetbrains.intellij") version "1.17.4"
66
id("io.gitlab.arturbosch.detekt") version "1.23.4"
77
}
88

@@ -91,13 +91,6 @@ tasks {
9191
token.set(System.getenv("PUBLISH_TOKEN"))
9292
}
9393

94-
generateLexer {
95-
sourceFile.set(project.file("src/main/grammars/RhaiLexer.flex"))
96-
targetDir.set("src/main/gen/org/rhai/")
97-
targetClass.set("RhaiLexer")
98-
purgeOldFiles.set(true)
99-
}
100-
10194
generateParser {
10295
sourceFile.set(project.file("src/main/grammars/Rhai.bnf"))
10396
targetRoot.set("src/main/gen")
@@ -106,8 +99,16 @@ tasks {
10699
purgeOldFiles.set(true)
107100
}
108101

102+
generateLexer {
103+
dependsOn(generateParser)
104+
sourceFile.set(project.file("src/main/grammars/RhaiLexer.flex"))
105+
targetDir.set("src/main/gen/org/rhai/")
106+
targetClass.set("RhaiLexer")
107+
purgeOldFiles.set(false)
108+
}
109+
109110
compileKotlin {
110-
dependsOn(generateLexer, generateParser)
111+
dependsOn(generateLexer)
111112
}
112113

113114
clean {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/kotlin/org/rhai/features/RhaiCompletionContributor.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,6 @@ class RhaiCompletionContributor : CompletionContributor() {
581581
if (actualModuleName != moduleName) {
582582
val adjustedStart = completionStart + adjustment
583583
val adjustedEnd = completionEnd + adjustment
584-
585-
val oldText = "$moduleName::$symbolName"
586584
val newText = "$actualModuleName::$symbolName"
587585

588586
document.replaceString(adjustedStart, adjustedEnd, newText)

src/main/kotlin/org/rhai/features/RhaiFormatter.kt

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ package org.rhai.features
33
import com.intellij.formatting.*
44
import com.intellij.lang.ASTNode
55
import com.intellij.openapi.util.TextRange
6-
import com.intellij.psi.PsiElement
7-
import com.intellij.psi.PsiFile
86
import com.intellij.psi.TokenType
97
import com.intellij.psi.codeStyle.CodeStyleSettings
108
import com.intellij.psi.codeStyle.CommonCodeStyleSettings
119
import com.intellij.psi.formatter.FormatterUtil
12-
import com.intellij.psi.tree.IElementType
1310
import com.intellij.psi.tree.TokenSet
1411
import org.rhai.RhaiTypes
1512
import org.rhai.lang.RhaiLanguage
@@ -183,22 +180,6 @@ class RhaiFormattingBlock(
183180
private var subBlocks: List<Block>? = null
184181

185182
companion object {
186-
private val BLOCKS = TokenSet.create(
187-
RhaiTypes.BLOCK,
188-
RhaiTypes.FUNCTION_DEFINITION,
189-
RhaiTypes.IF_STATEMENT,
190-
RhaiTypes.IF_EXPRESSION,
191-
RhaiTypes.WHILE_STATEMENT,
192-
RhaiTypes.FOR_STATEMENT,
193-
RhaiTypes.LOOP_STATEMENT,
194-
RhaiTypes.DO_WHILE_STATEMENT,
195-
RhaiTypes.UNTIL_STATEMENT,
196-
RhaiTypes.SWITCH_EXPRESSION,
197-
RhaiTypes.TRY_CATCH_STATEMENT,
198-
RhaiTypes.MODULE_DECLARATION,
199-
RhaiTypes.CLOSURE_EXPR
200-
)
201-
202183
private val BRACES = TokenSet.create(
203184
RhaiTypes.LBRACE,
204185
RhaiTypes.RBRACE,
@@ -207,14 +188,6 @@ class RhaiFormattingBlock(
207188
RhaiTypes.LPAREN,
208189
RhaiTypes.RPAREN
209190
)
210-
211-
private val CONTAINERS = TokenSet.create(
212-
RhaiTypes.ARRAY_LITERAL,
213-
RhaiTypes.OBJECT_LITERAL,
214-
RhaiTypes.PARAMETERS,
215-
RhaiTypes.ARGUMENT_LIST,
216-
RhaiTypes.CLOSURE_PARAMS
217-
)
218191
}
219192

220193
override fun getNode(): ASTNode = node

src/main/kotlin/org/rhai/features/RhaiTypedHandler.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ package org.rhai.features
22

33
import com.intellij.codeInsight.editorActions.TypedHandlerDelegate
44
import com.intellij.openapi.editor.Editor
5-
import com.intellij.openapi.fileTypes.FileType
65
import com.intellij.openapi.project.Project
76
import com.intellij.psi.PsiFile
87
import org.rhai.lang.RhaiFileType
9-
import org.rhai.RhaiTypes
108

119
class RhaiTypedHandler : TypedHandlerDelegate() {
1210

src/main/kotlin/org/rhai/inspections/RhaiQuickFixes.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ package org.rhai.inspections
22

33
import com.intellij.codeInspection.LocalQuickFix
44
import com.intellij.codeInspection.ProblemDescriptor
5-
import com.intellij.openapi.editor.Editor
65
import com.intellij.openapi.fileEditor.FileEditorManager
76
import com.intellij.openapi.project.Project
87
import com.intellij.psi.PsiDocumentManager
9-
import com.intellij.psi.PsiElement
108
import com.intellij.psi.util.PsiTreeUtil
119
import org.rhai.RhaiBlock
1210
import org.rhai.RhaiFunctionDefinition

src/main/kotlin/org/rhai/refactoring/RhaiPsiFactory.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ class RhaiPsiFactory(private val project: Project) {
2222
// Create a simple let declaration to extract the identifier
2323
val file = createFile("let $name = 0;")
2424
val letDecl = PsiTreeUtil.findChildOfType(file, RhaiLetDeclaration::class.java)
25-
?: throw IllegalStateException("Failed to create identifier PSI element")
25+
?: error("Failed to create identifier PSI element")
2626

2727
val identifierNode = letDecl.pattern.node.findChildByType(RhaiTypes.IDENTIFIER)
28-
?: throw IllegalStateException("Failed to find identifier in created element")
28+
?: error("Failed to find identifier in created element")
2929

3030
return identifierNode.psi
3131
}

src/main/kotlin/org/rhai/registry/RhaiRegistryCodeParser.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class RhaiRegistryCodeParser(private val project: Project) {
105105
constants.add(ParsedRegistryEntry(name, RegistryEntryKind.CONSTANT, typeAnnotation))
106106
}
107107
}
108-
} catch (e: Exception) {
108+
} catch (@Suppress("SwallowedException") e: Exception) {
109109
// Ignore parsing errors - just return empty results for unparseable code
110110
}
111111

0 commit comments

Comments
 (0)