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 #54

Merged
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
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 @@ -83,12 +84,11 @@ class LuaEnterAfterUnmatchedBraceHandler : EnterHandlerDelegate {
}

if (shouldClose && range != null) {
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