From 9b728ffd0b2ee5d306c4bb2259ee6088e4af63d6 Mon Sep 17 00:00:00 2001 From: zhe Date: Tue, 26 May 2026 15:04:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9IDE=E6=8A=A5=E9=94=99=20P?= =?UTF-8?q?lease=20override=20getConfigurableId=20or=20getLanguage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lua/editor/formatter/LuaCodeStyleSettingsProvider.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/tang/intellij/lua/editor/formatter/LuaCodeStyleSettingsProvider.kt b/src/main/java/com/tang/intellij/lua/editor/formatter/LuaCodeStyleSettingsProvider.kt index 084f81972..b8f1fa022 100644 --- a/src/main/java/com/tang/intellij/lua/editor/formatter/LuaCodeStyleSettingsProvider.kt +++ b/src/main/java/com/tang/intellij/lua/editor/formatter/LuaCodeStyleSettingsProvider.kt @@ -54,6 +54,8 @@ class LuaCodeStyleSettingsProvider : CodeStyleSettingsProvider() { } } + override fun getLanguage() = LuaLanguage.INSTANCE + override fun getConfigurableDisplayName() = LuaLanguage.INSTANCE.displayName override fun createCustomSettings(settings: CodeStyleSettings): CustomCodeStyleSettings { From 83dc7d03171f846375208bf4a660eae640d18d23 Mon Sep 17 00:00:00 2001 From: zhe Date: Wed, 27 May 2026 14:28:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8A=A5=E9=94=99=20java.lang.Throwable:?= =?UTF-8?q?=20Don't=20call=20commitAndRunReadAction=20inside=20ReadAction,?= =?UTF-8?q?=20it=20will=20cause=20a=20deadlock.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lua/debugger/LuaDebuggerEvaluator.kt | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/tang/intellij/lua/debugger/LuaDebuggerEvaluator.kt b/src/main/java/com/tang/intellij/lua/debugger/LuaDebuggerEvaluator.kt index cdd38b666..2895a3119 100644 --- a/src/main/java/com/tang/intellij/lua/debugger/LuaDebuggerEvaluator.kt +++ b/src/main/java/com/tang/intellij/lua/debugger/LuaDebuggerEvaluator.kt @@ -34,33 +34,31 @@ import com.tang.intellij.lua.psi.* abstract class LuaDebuggerEvaluator : XDebuggerEvaluator() { override fun getExpressionRangeAtOffset(project: Project, document: Document, offset: Int, sideEffectsAllowed: Boolean): TextRange? { var currentRange: TextRange? = null - PsiDocumentManager.getInstance(project).commitAndRunReadAction { - try { - val file = PsiDocumentManager.getInstance(project).getPsiFile(document) ?: return@commitAndRunReadAction - if (currentRange == null) { - val ele = file.findElementAt(offset) - if (ele != null && ele.node.elementType == LuaTypes.ID) { - val parent = ele.parent - when (parent) { - is LuaFuncDef, - is LuaLocalFuncDef -> currentRange = ele.textRange - is LuaClassMethodName, - is PsiNameIdentifierOwner -> currentRange = parent.textRange - } + try { + val file = PsiDocumentManager.getInstance(project).getPsiFile(document) ?: return null + if (currentRange == null) { + val ele = file.findElementAt(offset) + if (ele != null && ele.node.elementType == LuaTypes.ID) { + val parent = ele.parent + when (parent) { + is LuaFuncDef, + is LuaLocalFuncDef -> currentRange = ele.textRange + is LuaClassMethodName, + is PsiNameIdentifierOwner -> currentRange = parent.textRange } } + } - if (currentRange == null) { - val expr = PsiTreeUtil.findElementOfClassAtOffset(file, offset, LuaExpr::class.java, false) - currentRange = when (expr) { - is LuaCallExpr, - is LuaClosureExpr, - is LuaLiteralExpr -> null - else -> expr?.textRange - } + if (currentRange == null) { + val expr = PsiTreeUtil.findElementOfClassAtOffset(file, offset, LuaExpr::class.java, false) + currentRange = when (expr) { + is LuaCallExpr, + is LuaClosureExpr, + is LuaLiteralExpr -> null + else -> expr?.textRange } - } catch (ignored: IndexNotReadyException) { } + } catch (ignored: IndexNotReadyException) { } return currentRange }