mirror of
https://github.com/chylex/IntelliJ-Rainbow-Brackets.git
synced 2025-05-06 06:34:07 +02:00
Add support for disable rainbowify Python keywords
This commit is contained in:
parent
afb33674f6
commit
777d0e01a5
src/main/kotlin/com/github/izhangzhihao/rainbow/brackets
@ -7,7 +7,7 @@ import org.jetbrains.annotations.Nls
|
||||
import javax.swing.JComponent
|
||||
|
||||
class RainbowConfigurable : SearchableConfigurable {
|
||||
var settingsForm: RainbowSettingsForm? = null
|
||||
private var settingsForm: RainbowSettingsForm? = null
|
||||
|
||||
override fun createComponent(): JComponent? {
|
||||
settingsForm = settingsForm ?: RainbowSettingsForm()
|
||||
@ -43,6 +43,7 @@ class RainbowConfigurable : SearchableConfigurable {
|
||||
settings.rainbowifyTagNameInXML = settingsForm?.rainbowifyTagNameInXML() ?: false
|
||||
settings.doNOTRainbowifyTemplateString = settingsForm?.doNOTRainbowifyTemplateString() ?: false
|
||||
settings.doNOTRainbowifyBigFiles = settingsForm?.doNOTRainbowifyBigFiles() ?: true
|
||||
settings.rainbowifyPythonKeywords = settingsForm?.rainbowifyPythonKeywords() ?: false
|
||||
}
|
||||
|
||||
override fun reset() {
|
||||
|
@ -46,6 +46,7 @@ class RainbowSettings : PersistentStateComponent<RainbowSettings> {
|
||||
var suppressDisabledCheck = false
|
||||
var suppressBigFileCheck = false
|
||||
var suppressBlackListCheck = false
|
||||
var rainbowifyPythonKeywords = false
|
||||
|
||||
@Nullable
|
||||
override fun getState() = this
|
||||
|
@ -3,12 +3,12 @@
|
||||
<grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="763" height="533"/>
|
||||
<xy x="20" y="20" width="763" height="559"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="fd26e" binding="appearancePanel" layout-manager="GridLayoutManager" row-count="18" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="fd26e" binding="appearancePanel" layout-manager="GridLayoutManager" row-count="19" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
@ -99,7 +99,7 @@
|
||||
</component>
|
||||
<component id="9d54" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="16" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<grid row="17" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="96" height="14"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@ -109,7 +109,7 @@
|
||||
</component>
|
||||
<component id="b2481" class="javax.swing.JTextField" binding="numberOfColors">
|
||||
<constraints>
|
||||
<grid row="16" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="17" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@ -168,7 +168,7 @@
|
||||
</component>
|
||||
<component id="6e2da" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="17" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<grid row="18" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="115" height="26"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@ -178,7 +178,7 @@
|
||||
</component>
|
||||
<component id="d47de" class="javax.swing.JTextField" binding="languageBlacklist">
|
||||
<constraints>
|
||||
<grid row="17" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="18" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@ -186,6 +186,14 @@
|
||||
<text value="hocon, mxml"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="d240a" class="javax.swing.JCheckBox" binding="rainbowifyPythonKeywords">
|
||||
<constraints>
|
||||
<grid row="16" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Rainbowify Python keywords"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<vspacer id="9e387">
|
||||
|
@ -35,6 +35,8 @@ class RainbowSettingsForm {
|
||||
|
||||
private var doNOTRainbowifyBigFiles: JCheckBox? = null
|
||||
|
||||
private var rainbowifyPythonKeywords: JCheckBox? = null
|
||||
|
||||
private val settings: RainbowSettings = RainbowSettings.instance
|
||||
|
||||
fun component(): JComponent? = panel
|
||||
@ -63,7 +65,8 @@ class RainbowSettingsForm {
|
||||
|
||||
fun numberOfColors() = numberOfColors?.text?.toIntOrNull()
|
||||
|
||||
fun languageBlacklist() = languageBlacklist?.text?.split(",")?.map { it.trim() }?.filterNot { it.isEmpty() }?.toSet()
|
||||
fun languageBlacklist() =
|
||||
languageBlacklist?.text?.split(",")?.map { it.trim() }?.filterNot { it.isEmpty() }?.toSet()
|
||||
|
||||
fun disableRainbowIndentsInZenMode() = disableRainbowIndentsInZenMode?.isSelected
|
||||
|
||||
@ -75,6 +78,8 @@ class RainbowSettingsForm {
|
||||
|
||||
fun doNOTRainbowifyBigFiles() = doNOTRainbowifyBigFiles?.isSelected
|
||||
|
||||
fun rainbowifyPythonKeywords() = rainbowifyPythonKeywords?.isSelected
|
||||
|
||||
val isModified: Boolean
|
||||
get() = (isRainbowEnabled() != settings.isRainbowEnabled
|
||||
|| isRainbowAngleBracketsEnabled() != settings.isEnableRainbowAngleBrackets
|
||||
@ -94,6 +99,7 @@ class RainbowSettingsForm {
|
||||
|| doNOTRainbowifyTemplateString() != settings.doNOTRainbowifyTemplateString
|
||||
|| doNOTRainbowifyBigFiles() != settings.doNOTRainbowifyBigFiles
|
||||
|| languageBlacklist() != settings.languageBlacklist
|
||||
|| rainbowifyPythonKeywords() != settings.rainbowifyPythonKeywords
|
||||
)
|
||||
|
||||
init {
|
||||
@ -119,5 +125,6 @@ class RainbowSettingsForm {
|
||||
doNOTRainbowifyTemplateString?.isSelected = settings.doNOTRainbowifyTemplateString
|
||||
doNOTRainbowifyBigFiles?.isSelected = settings.doNOTRainbowifyBigFiles
|
||||
languageBlacklist?.text = settings.languageBlacklist.joinToString(",")
|
||||
rainbowifyPythonKeywords?.isSelected = settings.rainbowifyPythonKeywords
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ class PythonRainbowVisitor : RainbowHighlightVisitor() {
|
||||
|
||||
override fun suitableForFile(file: PsiFile)
|
||||
: Boolean = super.suitableForFile(file) &&
|
||||
RainbowSettings.instance.isEnableRainbowAngleBrackets &&
|
||||
RainbowSettings.instance.rainbowifyPythonKeywords &&
|
||||
(file.language.id == "Python" ||
|
||||
file.viewProvider.allFiles.any { it.language.id == "Python" }
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user