-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(intellij): implemented brace matcher for variables
- Loading branch information
Showing
6 changed files
with
91 additions
and
7 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/editor/RobotCodeBraceMatcher.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package dev.robotcode.robotcode4ij.editor | ||
|
||
import com.intellij.lang.BracePair | ||
import com.intellij.lang.PairedBraceMatcher | ||
import com.intellij.psi.PsiFile | ||
import com.intellij.psi.tree.IElementType | ||
import dev.robotcode.robotcode4ij.psi.ENVIRONMENT_VARIABLE_BEGIN | ||
import dev.robotcode.robotcode4ij.psi.ENVIRONMENT_VARIABLE_END | ||
import dev.robotcode.robotcode4ij.psi.VARIABLE_BEGIN | ||
import dev.robotcode.robotcode4ij.psi.VARIABLE_END | ||
|
||
private val PAIRS = arrayOf( | ||
BracePair(VARIABLE_BEGIN, VARIABLE_END, false), | ||
BracePair(ENVIRONMENT_VARIABLE_BEGIN, ENVIRONMENT_VARIABLE_END, false) | ||
) | ||
|
||
class RobotCodeBraceMatcher : PairedBraceMatcher { | ||
|
||
override fun getPairs(): Array<BracePair> { | ||
return PAIRS | ||
} | ||
|
||
override fun isPairedBracesAllowedBeforeType(lbraceType: IElementType, contextType: IElementType?): Boolean { | ||
return true | ||
} | ||
|
||
override fun getCodeConstructStart(file: PsiFile?, openingBraceOffset: Int): Int { | ||
return openingBraceOffset | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters