Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed wrong endType symbol in UnmatchedBraceHandler #413

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
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