Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/com/tang/intellij/lua/braces/LuaBraceMatcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class LuaBraceMatcher : PairedBraceMatcher {
return true
}

override fun getCodeConstructStart(psiFile: PsiFile, i: Int): Int {
return i
override fun getCodeConstructStart(psiFile: PsiFile, openingOffset: Int): Int {
return openingOffset
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class LuaEnterAfterUnmatchedBraceHandler : EnterHandlerDelegate {
var shouldClose = false
var range: PsiElement? = null
var cur: PsiElement = lElement
val endTypeAtCaret = getEnd(cur.parent.node.elementType)
while (true) {
val searched = cur.parent
if (searched == null || searched is PsiFile) break
Expand All @@ -86,9 +87,9 @@ class LuaEnterAfterUnmatchedBraceHandler : EnterHandlerDelegate {
val endType = getEnd(range.node.elementType)
val document = editor.document
if (rElement !is PsiWhiteSpace)
document.insertString(caretOffset, "$endType ")
document.insertString(caretOffset, "$endTypeAtCaret ")
else
document.insertString(caretOffset, "$endType")
document.insertString(caretOffset, "$endTypeAtCaret")
editorActionHandler?.execute(editor, editor.caretModel.currentCaret, dataContext)

val project = lElement.project
Expand Down