From 325fd2c2054803ffd98253525ae5458315d56b8e Mon Sep 17 00:00:00 2001 From: Darwin Esteban Algarin Sarmiento Date: Mon, 7 Jun 2021 17:10:54 -0500 Subject: [PATCH 1/3] Fixed issue with formatting code. --- build.gradle | 6 +- src/main/grammar/FirebaseRules.bnf | 5 +- .../formatter/FirebaseAlignmentStrategy.kt | 86 +++++++++++++++ .../ide/formatter/FirebaseFmtContext.kt | 19 ++++ .../ide/formatter/FirebaseFormatterBlock.kt | 41 +++++-- .../FirebaseFormattingModelBuilder.kt | 6 +- .../firebase/ide/formatter/impl/alignment.kt | 19 ++++ .../firebase/ide/formatter/impl/indent.kt | 61 +++++++++++ .../firebase/ide/formatter/impl/spacing.kt | 45 ++++++++ .../labs/firebase/ide/formatter/impl/utils.kt | 34 ++++++ .../labs/firebase/ide/formatter/processor.kt | 101 ------------------ 11 files changed, 302 insertions(+), 121 deletions(-) create mode 100644 src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseAlignmentStrategy.kt create mode 100644 src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFmtContext.kt create mode 100644 src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/alignment.kt create mode 100644 src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/indent.kt create mode 100644 src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/spacing.kt create mode 100644 src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/utils.kt delete mode 100644 src/main/kotlin/co/anbora/labs/firebase/ide/formatter/processor.kt diff --git a/build.gradle b/build.gradle index fef717b..9be6280 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,14 @@ -import org.jetbrains.grammarkit.tasks.* - plugins { id 'java' id 'org.jetbrains.intellij' version '0.6.5' id 'org.jetbrains.kotlin.jvm' version '1.4.10' - id "org.jetbrains.grammarkit" version "2021.1.2" + id "org.jetbrains.grammarkit" version "2021.1.3" } apply plugin: 'org.jetbrains.grammarkit' +import org.jetbrains.grammarkit.tasks.* + group 'co.anbora.labs' version '2.5.8' diff --git a/src/main/grammar/FirebaseRules.bnf b/src/main/grammar/FirebaseRules.bnf index 1cfefca..4755526 100644 --- a/src/main/grammar/FirebaseRules.bnf +++ b/src/main/grammar/FirebaseRules.bnf @@ -13,7 +13,6 @@ elementTypeClass="co.anbora.labs.firebase.lang.core.psi.FirebaseElementType" tokenTypeClass="co.anbora.labs.firebase.lang.core.psi.FirebaseTokenType" - extends(".+Expression") = Expression extends(".+Expr") = Expression name(".*Expr")="expr" @@ -205,7 +204,9 @@ TernaryExpr ::= Expression '?' Expression ':' Expression IdentifierExpr ::= IDENTIFIER DotExpr ::= Expression DOT Expression -CallExpr ::= Expression '(' ParameterStatement? ')' +CallExpr ::= Expression CallArguments +CallArguments ::= '(' ParameterStatement? ')' +//CallArguments ::= '(' (Expression &(','|')'))? ')' { pin = 1 } LiteralExpr ::= LiteralStatement | BooleanStatement diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseAlignmentStrategy.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseAlignmentStrategy.kt new file mode 100644 index 0000000..fa14e53 --- /dev/null +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseAlignmentStrategy.kt @@ -0,0 +1,86 @@ +/* + * Use of this source code is governed by the MIT license that can be + * found in the LICENSE file. + */ + +package co.anbora.labs.firebase.ide.formatter + +import com.intellij.formatting.Alignment +import com.intellij.lang.ASTNode +import com.intellij.psi.tree.IElementType +import com.intellij.psi.tree.TokenSet + +interface FirebaseAlignmentStrategy { + /** + * Requests current strategy for alignment to use for given child. + */ + fun getAlignment(child: ASTNode, parent: ASTNode?, childCtx: FirebaseFmtContext): Alignment? + + /** + * Always returns `null`. + */ + object NullStrategy : FirebaseAlignmentStrategy { + override fun getAlignment(child: ASTNode, parent: ASTNode?, childCtx: FirebaseFmtContext): Alignment? = null + } + + /** + * Apply this strategy only when child element is in [tt]. + */ + fun alignIf(vararg tt: IElementType): FirebaseAlignmentStrategy = alignIf(TokenSet.create(*tt)) + + /** + * Apply this strategy only when child element type matches [filterSet]. + */ + fun alignIf(filterSet: TokenSet): FirebaseAlignmentStrategy = + object : FirebaseAlignmentStrategy { + override fun getAlignment(child: ASTNode, parent: ASTNode?, childCtx: FirebaseFmtContext): Alignment? = + if (child.elementType in filterSet) { + this@FirebaseAlignmentStrategy.getAlignment(child, parent, childCtx) + } else { + null + } + } + + /** + * Apply this strategy only when [predicate] passes. + */ + fun alignIf(predicate: (child: ASTNode, parent: ASTNode?, ctx: FirebaseFmtContext) -> Boolean): FirebaseAlignmentStrategy = + object : FirebaseAlignmentStrategy { + override fun getAlignment(child: ASTNode, parent: ASTNode?, childCtx: FirebaseFmtContext): Alignment? = + if (predicate(child, parent, childCtx)) { + this@FirebaseAlignmentStrategy.getAlignment(child, parent, childCtx) + } else { + null + } + } + + /** + * Returns [NullStrategy] if [condition] is `false`. Useful for making strategies configurable. + */ + fun alignIf(condition: Boolean): FirebaseAlignmentStrategy = + if (condition) { + this + } else { + NullStrategy + } + + companion object { + /** + * Always returns [alignment]. + */ + fun wrap(alignment: Alignment = Alignment.createAlignment()): FirebaseAlignmentStrategy = + object : FirebaseAlignmentStrategy { + override fun getAlignment(child: ASTNode, parent: ASTNode?, childCtx: FirebaseFmtContext): Alignment? = + alignment + } + + /** + * Always returns [FirebaseFmtContext.sharedAlignment] + */ + fun shared(): FirebaseAlignmentStrategy = + object : FirebaseAlignmentStrategy { + override fun getAlignment(child: ASTNode, parent: ASTNode?, childCtx: FirebaseFmtContext): Alignment? = + childCtx.sharedAlignment + } + } +} diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFmtContext.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFmtContext.kt new file mode 100644 index 0000000..b6301d7 --- /dev/null +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFmtContext.kt @@ -0,0 +1,19 @@ +package co.anbora.labs.firebase.ide.formatter + +import co.anbora.labs.firebase.ide.formatter.impl.createSpacingBuilder +import com.intellij.formatting.Alignment +import com.intellij.formatting.SpacingBuilder +import com.intellij.psi.codeStyle.CodeStyleSettings + +data class FirebaseFmtContext private constructor( + val commonSettings: CodeStyleSettings, + val spacingBuilder: SpacingBuilder, + val sharedAlignment: Alignment? = null +) { + companion object { + fun create(settings: CodeStyleSettings): FirebaseFmtContext { + return FirebaseFmtContext(settings, createSpacingBuilder(settings)) + } + } + +} \ No newline at end of file diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFormatterBlock.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFormatterBlock.kt index af04caf..9fe7446 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFormatterBlock.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFormatterBlock.kt @@ -1,5 +1,7 @@ package co.anbora.labs.firebase.ide.formatter +import co.anbora.labs.firebase.ide.formatter.impl.* +import co.anbora.labs.firebase.lang.core.psi.FirebaseRulesTypes.* import com.intellij.formatting.* import com.intellij.lang.ASTNode import com.intellij.psi.formatter.common.AbstractBlock @@ -8,32 +10,49 @@ class FirebaseFormatterBlock( node: ASTNode, wrap: Wrap? = null, alignment: Alignment? = null, - val spacingBuilder: SpacingBuilder + private val indent: Indent?, + val ctx: FirebaseFmtContext ): AbstractBlock(node, wrap, alignment) { override fun isLeaf(): Boolean = node.firstChildNode == null + override fun getIndent(): Indent? = indent - override fun getIndent(): Indent? - = computeIndent() - - override fun getChildAttributes(newChildIndex: Int): ChildAttributes - = computeChildAttributes() - - override fun getSpacing(child1: Block?, child2: Block): Spacing? - = computeSpacing(child1, child2) + override fun getSpacing(child1: Block?, child2: Block): Spacing? = computeSpacing(child1, child2, ctx) override fun getSubBlocks(): List = mySubBlocks - private val mySubBlocks: List by lazy { buildChildren() } override fun buildChildren(): List { + val sharedAlignment = when (node.elementType) { + FUNCTION_PARAMETER_LIST -> Alignment.createAlignment() + FUNCTION_PARAMETER -> ctx.sharedAlignment + else -> null + } + val alignment = getAlignmentStrategy() + return node.getChildren(null) .filter { !it.isWhitespaceOrEmpty() } .map { childNode: ASTNode -> + val childCtx = ctx.copy(sharedAlignment = sharedAlignment) + val indent = computeIndent(childNode) FirebaseFormatterBlock( node = childNode, - spacingBuilder = spacingBuilder + alignment = alignment.getAlignment(childNode, node, childCtx), + indent = indent, + wrap = null, + ctx = childCtx ) } } + + override fun getChildAttributes(newChildIndex: Int): ChildAttributes { + val indent = when { + node.elementType == CONDITIONAL_BLOCK -> Indent.getNoneIndent() + node.isDelimitedBlock -> Indent.getNormalIndent() + // Otherwise we don't want any indentation (null means continuation indent) + else -> Indent.getNoneIndent() + } + return ChildAttributes(indent, null) + } + } diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFormattingModelBuilder.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFormattingModelBuilder.kt index bc9929b..9a44514 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFormattingModelBuilder.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFormattingModelBuilder.kt @@ -5,12 +5,10 @@ import com.intellij.formatting.* class FirebaseFormattingModelBuilder: FormattingModelBuilder { override fun createModel(formattingContext: FormattingContext): FormattingModel { + val ctx = FirebaseFmtContext.create(formattingContext.codeStyleSettings) return FormattingModelProvider.createFormattingModelForPsiFile( formattingContext.containingFile, - FirebaseFormatterBlock( - node = formattingContext.node, - spacingBuilder = createSpacingBuilder(formattingContext.codeStyleSettings) - ), + FirebaseFormatterBlock(formattingContext.node, null, null, Indent.getNoneIndent(), ctx), formattingContext.codeStyleSettings ) } diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/alignment.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/alignment.kt new file mode 100644 index 0000000..947b6af --- /dev/null +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/alignment.kt @@ -0,0 +1,19 @@ +package co.anbora.labs.firebase.ide.formatter.impl + +import co.anbora.labs.firebase.ide.formatter.FirebaseAlignmentStrategy +import co.anbora.labs.firebase.ide.formatter.FirebaseFormatterBlock +import co.anbora.labs.firebase.lang.core.psi.FirebaseRulesTypes.CALL_ARGUMENTS +import co.anbora.labs.firebase.lang.core.psi.FirebaseRulesTypes.FUNCTION_PARAMETER_LIST + +fun FirebaseFormatterBlock.getAlignmentStrategy(): FirebaseAlignmentStrategy = when (node.elementType) { + FUNCTION_PARAMETER_LIST, CALL_ARGUMENTS -> + FirebaseAlignmentStrategy + .shared() + .alignUnlessBlockDelim() + .alignIf(ctx.commonSettings.ALIGN_MULTILINE_PARAMETERS) + else -> FirebaseAlignmentStrategy.NullStrategy + +} + +fun FirebaseAlignmentStrategy.alignUnlessBlockDelim(): FirebaseAlignmentStrategy = + alignIf { c, p, _ -> !c.isDelimiterOfCurrentBlock(p) } \ No newline at end of file diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/indent.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/indent.kt new file mode 100644 index 0000000..1d83ec5 --- /dev/null +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/indent.kt @@ -0,0 +1,61 @@ +package co.anbora.labs.firebase.ide.formatter.impl + +import co.anbora.labs.firebase.ide.formatter.FirebaseFormatterBlock +import co.anbora.labs.firebase.lang.core.psi.* +import co.anbora.labs.firebase.lang.core.psi.FirebaseRulesTypes.CONDITIONAL_BLOCK +import com.intellij.formatting.Indent +import com.intellij.lang.ASTNode + +fun FirebaseFormatterBlock.computeIndent(child: ASTNode): Indent? { +// val parentType = node.elementType + val parentPsi = node.psi +// val childType = child.elementType + val childPsi = child.psi + return when { + node.isDelimitedBlock -> getNormalIndentIfNotCurrentBlockDelimiter(child, node) + // do not indent statements + childPsi.prevSibling == null -> Indent.getNoneIndent() + // let a = + // 92; + // => + // let a = + // 92; + // except if RefExpr as lhs of assignment expr +// childPsi is MoveExpr +// && (parentType == LET_EXPR || parentType == ASSIGNMENT_EXPR || parentType == CONST_DEF) -> Indent.getNormalIndent() + childPsi is FirebaseRulesExpression + && parentPsi is FirebaseRulesVariableStatement -> Indent.getNormalIndent() + + childPsi is FirebaseRulesConditionalBlock + && parentPsi is FirebaseRulesConditionalStatement -> Indent.getNormalIndent() + + childPsi is FirebaseRulesConditionalStatement -> Indent.getNormalIndent() + + childPsi is FirebaseRulesConditionalBlock -> Indent.getNormalIndent() +// if (true) +// create() +// else +// delete() + parentPsi is FirebaseRulesServiceBlock + || parentPsi is FirebaseRulesMatchBlock + || parentPsi is FirebaseRulesFunctionBlock + || parentPsi is FirebaseRulesReturnBlock -> Indent.getNormalIndent() + + // binary expressions, chain calls + // no indent on it's own, use parent indent + parentPsi is FirebaseRulesExpression -> Indent.getIndent(Indent.Type.NONE, true, true) + + else -> Indent.getNoneIndent() + } +} + +fun getNormalIndentIfNotCurrentBlockDelimiter(child: ASTNode, parent: ASTNode): Indent = + if (child.isDelimiterOfCurrentBlock(parent)) { + Indent.getNoneIndent() + } else { + if (parent.elementType == CONDITIONAL_BLOCK) { + Indent.getNoneIndent() + } else { + Indent.getNormalIndent() + } + } diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/spacing.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/spacing.kt new file mode 100644 index 0000000..25e0e62 --- /dev/null +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/spacing.kt @@ -0,0 +1,45 @@ +package co.anbora.labs.firebase.ide.formatter.impl + +import co.anbora.labs.firebase.ide.formatter.FirebaseFmtContext +import co.anbora.labs.firebase.ide.formatter.FirebaseFormatterBlock +import co.anbora.labs.firebase.lang.FirebaseRulesLanguage +import co.anbora.labs.firebase.lang.core.psi.FirebaseRulesTypes.* +import com.intellij.formatting.Block +import com.intellij.formatting.Spacing +import com.intellij.formatting.SpacingBuilder +import com.intellij.psi.codeStyle.CodeStyleSettings + +fun FirebaseFormatterBlock.computeSpacing(child1: Block?, child2: Block, ctx: FirebaseFmtContext): Spacing? = ctx.spacingBuilder.getSpacing(this, child1, child2) + +fun createSpacingBuilder(commonSettings: CodeStyleSettings): SpacingBuilder { + return SpacingBuilder(commonSettings, FirebaseRulesLanguage) + //Rules Version + .after(RULES_VERSION).spacing(1, 1, 0, false, 0) + .after(EQ).spacing(1, 1, 0, false, 0) + .after(VERSIONS).spacing(0,0,0,false,0) + //Service Statement + .after(SERVICE_KEYWORD).spacing(1, 1, 0, false, 0) + .after(SERVICE_NAME).spacing(1, 1, 0, false, 0) + //Function Statement + .after(FUNCTION_KEYWORD).spacing(1, 1, 0, false, 0) + .after(FUNCTION_PARAMETER_LIST).spacing(1, 1, 0, false, 0) + //Match Statement + .after(MATCH_KEYWORD).spacing(1, 1, 0, false, 0) + .after(FULL_PATH_STATEMENT).spacing(1, 1, 0, false, 0) + //Allow Statement + .after(ALLOW_KEYWORD).spacing(1, 1, 0, false, 0) + .after(PERMISSION_KEY_WORD).spacing(0,0,0,false,0) + .after(COMMA).spacing(1, 1, 0, false, 0) + .after(COLON).spacing(1, 1, 0, false, 0) + .after(IF_KEYWORD).spacing(1, 1, 0, false, 0) + .after(EXPRESSION).spacing(1, 1, 0, false, 0) + .after(OROR).spacing(1, 1, 0, false, 0) + .after(ANDAND).spacing(1, 1, 0, false, 0) + .after(LT).spacing(1, 1, 0, false, 0) + .after(GT).spacing(1, 1, 0, false, 0) + .after(LE).spacing(1, 1, 0, false, 0) + .after(GE).spacing(1, 1, 0, false, 0) + .after(EQEQ).spacing(1, 1, 0, false, 0) + .after(NE).spacing(1, 1, 0, false, 0) + .before(DOT_COMMA).spacing(0,0,0,false,0) +} \ No newline at end of file diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/utils.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/utils.kt new file mode 100644 index 0000000..dbe97fd --- /dev/null +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/utils.kt @@ -0,0 +1,34 @@ +package co.anbora.labs.firebase.ide.formatter.impl + +import co.anbora.labs.firebase.lang.core.psi.FirebaseRulesTypes.* +import com.intellij.lang.ASTNode +import com.intellij.psi.TokenType +import com.intellij.psi.tree.TokenSet + +val PAREN_DELIMITED_BLOCKS = TokenSet.create( + PARENS_EXPR, ARRAY_LITERAL_EXPR, + FUNCTION_PARAMETER_LIST, CALL_ARGUMENTS +) + +val BLOCK_LIKE = TokenSet.create( + SERVICE_BLOCK, MATCH_BLOCK, + FUNCTION_BLOCK, RETURN_BLOCK +) + +val DELIMITED_BLOCKS = TokenSet.orSet(PAREN_DELIMITED_BLOCKS, BLOCK_LIKE) + +fun ASTNode?.isWhitespaceOrEmpty() = this == null || textLength == 0 || elementType == TokenType.WHITE_SPACE + +val ASTNode.isDelimitedBlock: Boolean + get() = elementType in DELIMITED_BLOCKS + +fun ASTNode.isDelimiterOfCurrentBlock(parent: ASTNode?): Boolean { + if (parent == null) return false + val parentType = parent.elementType + return when (elementType) { + LEFT_BRACE, RIGHT_BRACE -> parentType in BLOCK_LIKE + LB, RB -> parentType in BLOCK_LIKE + LP, RP -> parentType in PAREN_DELIMITED_BLOCKS + else -> false + } +} \ No newline at end of file diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/processor.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/processor.kt deleted file mode 100644 index 499c14f..0000000 --- a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/processor.kt +++ /dev/null @@ -1,101 +0,0 @@ -package co.anbora.labs.firebase.ide.formatter - -import co.anbora.labs.firebase.lang.FirebaseRulesLanguage -import co.anbora.labs.firebase.lang.core.psi.FirebaseRulesParameterStatement -import co.anbora.labs.firebase.lang.core.psi.FirebaseRulesTypes.* -import com.intellij.formatting.* -import com.intellij.lang.ASTNode -import com.intellij.psi.TokenType -import com.intellij.psi.codeStyle.CodeStyleSettings -import com.intellij.psi.tree.IElementType - -fun FirebaseFormatterBlock.computeIndent(): Indent? { - val parent = node.treeParent - val psi = node.psi - return when { - parent?.treeParent == null -> Indent.getNoneIndent() - node.areBraces() -> Indent.getNoneIndent() - node.isBooleanOperator() -> Indent.getNormalIndent() - parent.isComposeBlock() -> Indent.getNormalIndent() - parent.isBooleanExpr() -> Indent.getNormalIndent() - parent.isCallExpr() && psi is FirebaseRulesParameterStatement -> Indent.getNormalIndent() - else -> Indent.getNoneIndent() - } -} - -fun FirebaseFormatterBlock.computeChildAttributes(): ChildAttributes { - val indent = when { - node.isComposeBlock() -> Indent.getNormalIndent() - // Otherwise we don't want any indentation (null means continuation indent) - else -> Indent.getNoneIndent() - } - return ChildAttributes(indent, null) -} - -fun FirebaseFormatterBlock.computeSpacing(child1: Block?, child2: Block): Spacing? = this.spacingBuilder.getSpacing(this, child1, child2) - -fun createSpacingBuilder(commonSettings: CodeStyleSettings): SpacingBuilder { - return SpacingBuilder(commonSettings, FirebaseRulesLanguage) - //Rules Version - .after(RULES_VERSION).spacing(1, 1, 0, false, 0) - .after(EQ).spacing(1, 1, 0, false, 0) - .after(VERSIONS).spacing(0,0,0,false,0) - //Service Statement - .after(SERVICE_KEYWORD).spacing(1, 1, 0, false, 0) - .after(SERVICE_NAME).spacing(1, 1, 0, false, 0) - //Function Statement - .after(FUNCTION_KEYWORD).spacing(1, 1, 0, false, 0) - .after(FUNCTION_PARAMETER_LIST).spacing(1, 1, 0, false, 0) - //Match Statement - .after(MATCH_KEYWORD).spacing(1, 1, 0, false, 0) - .after(FULL_PATH_STATEMENT).spacing(1, 1, 0, false, 0) - //Allow Statement - .after(ALLOW_KEYWORD).spacing(1, 1, 0, false, 0) - .after(PERMISSION_KEY_WORD).spacing(0,0,0,false,0) - .after(COMMA).spacing(1, 1, 0, false, 0) - .after(COLON).spacing(1, 1, 0, false, 0) - .after(IF_KEYWORD).spacing(1, 1, 0, false, 0) - .after(EXPRESSION).spacing(1, 1, 0, false, 0) - .after(OROR).spacing(1, 1, 0, false, 0) - .after(ANDAND).spacing(1, 1, 0, false, 0) - .after(LT).spacing(1, 1, 0, false, 0) - .after(GT).spacing(1, 1, 0, false, 0) - .after(LE).spacing(1, 1, 0, false, 0) - .after(GE).spacing(1, 1, 0, false, 0) - .after(EQEQ).spacing(1, 1, 0, false, 0) - .after(NE).spacing(1, 1, 0, false, 0) - .before(DOT_COMMA).spacing(0,0,0,false,0) -} - -fun ASTNode.areBraces(): Boolean { - return (elementType === LEFT_BRACE || elementType === RIGHT_BRACE) -} - -fun ASTNode.isBooleanOperator(): Boolean { - val elementType: IElementType = this.elementType - return elementType == OROR || - elementType == ANDAND -} - -fun ASTNode.isCallExpr(): Boolean { - return this.elementType == CALL_EXPR -} - -fun ASTNode.isBooleanExpr(): Boolean { - return this.elementType == OR_EXPR - || this.elementType == AND_EXPR -} - -fun ASTNode.isParenthesisBlock(): Boolean { - return this.elementType == PARENS_EXPR -} - -fun ASTNode.isComposeBlock(): Boolean { - val elementType: IElementType = this.elementType - return elementType == SERVICE_BLOCK || - elementType == MATCH_BLOCK || - elementType == FUNCTION_BLOCK || - elementType == RETURN_BLOCK -} - -fun ASTNode?.isWhitespaceOrEmpty() = this == null || textLength == 0 || elementType == TokenType.WHITE_SPACE From 419bd16165dd34fe5939d099e916fa580be0edf6 Mon Sep 17 00:00:00 2001 From: Darwin Esteban Algarin Sarmiento Date: Mon, 7 Jun 2021 20:06:49 -0500 Subject: [PATCH 2/3] Added code style configuration. --- build.gradle | 2 +- src/main/html/change-notes.html | 5 +++ .../ide/color/FirebaseColorSettingPage.kt | 33 +--------------- .../style/FirebaseCodeStyleConfigurable.kt | 18 +++++++++ .../ide/style/FirebaseCodeStyleMainPanel.kt | 16 ++++++++ .../ide/style/FirebaseCodeStyleSettings.kt | 8 ++++ .../FirebaseCodeStyleSettingsProvider.kt | 21 ++++++++++ ...irebaseLanguageCodeStyleSettingProvider.kt | 33 ++++++++++++++++ .../labs/firebase/lang/FirebaseFileType.kt | 5 ++- .../firebase/lang/FirebaseRulesLanguage.kt | 38 ++++++++++++++++++- src/main/resources/META-INF/plugin.xml | 4 ++ 11 files changed, 148 insertions(+), 35 deletions(-) create mode 100644 src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleConfigurable.kt create mode 100644 src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleMainPanel.kt create mode 100644 src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettings.kt create mode 100644 src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettingsProvider.kt create mode 100644 src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseLanguageCodeStyleSettingProvider.kt diff --git a/build.gradle b/build.gradle index 9be6280..1957906 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ apply plugin: 'org.jetbrains.grammarkit' import org.jetbrains.grammarkit.tasks.* group 'co.anbora.labs' -version '2.5.8' +version '2.6.0' repositories { mavenCentral() diff --git a/src/main/html/change-notes.html b/src/main/html/change-notes.html index 6b83202..32a0a92 100644 --- a/src/main/html/change-notes.html +++ b/src/main/html/change-notes.html @@ -6,6 +6,11 @@
Plugin updates:
    +
  • 2.6.0 (2021-06-07) - Code Style
  • +
      +
    • Added code style configuration.
    • +
    • Fixed issue with code formatting.
    • +
  • 2.5.9 (2021-05-27) - Fixed minor issues - Android version
    • Added ternary operator
    • diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/color/FirebaseColorSettingPage.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/color/FirebaseColorSettingPage.kt index 3310452..a419f2a 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/ide/color/FirebaseColorSettingPage.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/color/FirebaseColorSettingPage.kt @@ -2,6 +2,7 @@ package co.anbora.labs.firebase.ide.color import co.anbora.labs.firebase.ide.highlight.FirebaseSyntaxHighlighter import co.anbora.labs.firebase.ide.icons.FirebaseIcons +import co.anbora.labs.firebase.lang.FirebaseRulesLanguage.LANGUAGE_DEMO_TEXT import com.intellij.openapi.editor.colors.TextAttributesKey import com.intellij.openapi.fileTypes.SyntaxHighlighter import com.intellij.openapi.options.colors.AttributesDescriptor @@ -23,37 +24,7 @@ class FirebaseColorSettingPage: ColorSettingsPage { override fun getHighlighter(): SyntaxHighlighter = FirebaseSyntaxHighlighter() - override fun getDemoText(): String = - """rules_version = '2'; -service cloud.firestore { - // Allow the requestor to read or delete any resource on a path under the - // user directory. - match /users/{userId}/{anyUserFile=**} { - allow read, delete: if request.auth != null && request.auth.uid == userId; - } - - match /databases/{database}/documents { - // True if the user is signed in or the requested data is 'public' - function signedInOrPublic() { - return request.auth.uid != null || resource.data.visibility == 'public'; - } - match /{role}/{document=**} { - allow read, write: if - request.time < timestamp.date(2020, 9, 23) && role in request.auth.token.authorities; - } - } - // Allow the requestor to create or update their own images. - // When 'request.method' == 'delete' this rule and the one matching - // any path under the user directory would both match and the `delete` - // would be permitted. - - match /users/{userId}/images/{imageId} { - // Whether to permit the request depends on the logical OR of all - // matched rules. This means that even if this rule did not explicitly - // allow the 'delete' the earlier rule would have. - allow write: if request.auth != null && request.auth.uid == userId && imageId.matches('*.png'); - } -}""" + override fun getDemoText(): String = LANGUAGE_DEMO_TEXT override fun getAdditionalHighlightingTagToDescriptorMap(): MutableMap = mutableMapOf() } diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleConfigurable.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleConfigurable.kt new file mode 100644 index 0000000..4cdfe0d --- /dev/null +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleConfigurable.kt @@ -0,0 +1,18 @@ +package co.anbora.labs.firebase.ide.style + +import co.anbora.labs.firebase.lang.FirebaseRulesLanguage +import com.intellij.application.options.CodeStyleAbstractConfigurable +import com.intellij.application.options.CodeStyleAbstractPanel +import com.intellij.psi.codeStyle.CodeStyleSettings + +class FirebaseCodeStyleConfigurable( + settings: CodeStyleSettings, + originalSettings: CodeStyleSettings? +): CodeStyleAbstractConfigurable(settings, originalSettings, FirebaseRulesLanguage.LANGUAGE_NAME) { + + override fun createPanel( + settings: CodeStyleSettings + ): CodeStyleAbstractPanel = FirebaseCodeStyleMainPanel(currentSettings, settings) + + override fun getHelpTopic(): String? = null +} \ No newline at end of file diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleMainPanel.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleMainPanel.kt new file mode 100644 index 0000000..db4289f --- /dev/null +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleMainPanel.kt @@ -0,0 +1,16 @@ +package co.anbora.labs.firebase.ide.style + +import co.anbora.labs.firebase.lang.FirebaseRulesLanguage +import com.intellij.application.options.TabbedLanguageCodeStylePanel +import com.intellij.psi.codeStyle.CodeStyleSettings + +class FirebaseCodeStyleMainPanel( + currentSettings: CodeStyleSettings, + settings: CodeStyleSettings +): TabbedLanguageCodeStylePanel(FirebaseRulesLanguage, currentSettings, settings) { + + override fun initTabs(settings: CodeStyleSettings?) { + addIndentOptionsTab(settings) + addSpacesTab(settings) + } +} \ No newline at end of file diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettings.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettings.kt new file mode 100644 index 0000000..4d16eb3 --- /dev/null +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettings.kt @@ -0,0 +1,8 @@ +package co.anbora.labs.firebase.ide.style + +import com.intellij.psi.codeStyle.CodeStyleSettings +import com.intellij.psi.codeStyle.CustomCodeStyleSettings + +class FirebaseCodeStyleSettings( + container: CodeStyleSettings? +): CustomCodeStyleSettings("FirebaseCodeStyleSettings", container) \ No newline at end of file diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettingsProvider.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettingsProvider.kt new file mode 100644 index 0000000..510533b --- /dev/null +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettingsProvider.kt @@ -0,0 +1,21 @@ +package co.anbora.labs.firebase.ide.style + +import co.anbora.labs.firebase.lang.FirebaseRulesLanguage.LANGUAGE_NAME +import com.intellij.openapi.options.Configurable +import com.intellij.psi.codeStyle.CodeStyleSettings +import com.intellij.psi.codeStyle.CodeStyleSettingsProvider +import com.intellij.psi.codeStyle.CustomCodeStyleSettings + +object FirebaseCodeStyleSettingsProvider: CodeStyleSettingsProvider() { + + override fun createCustomSettings( + settings: CodeStyleSettings? + ): CustomCodeStyleSettings = FirebaseCodeStyleSettings(settings) + + override fun getConfigurableDisplayName(): String = LANGUAGE_NAME + + override fun createSettingsPage( + settings: CodeStyleSettings, + originalSettings: CodeStyleSettings? + ): Configurable = FirebaseCodeStyleConfigurable(settings, originalSettings) +} \ No newline at end of file diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseLanguageCodeStyleSettingProvider.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseLanguageCodeStyleSettingProvider.kt new file mode 100644 index 0000000..3590b8c --- /dev/null +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseLanguageCodeStyleSettingProvider.kt @@ -0,0 +1,33 @@ +package co.anbora.labs.firebase.ide.style + +import co.anbora.labs.firebase.lang.FirebaseRulesLanguage +import co.anbora.labs.firebase.lang.FirebaseRulesLanguage.LANGUAGE_DEMO_TEXT +import com.intellij.application.options.IndentOptionsEditor +import com.intellij.application.options.SmartIndentOptionsEditor +import com.intellij.lang.Language +import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizable +import com.intellij.psi.codeStyle.CommonCodeStyleSettings +import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider + +object FirebaseLanguageCodeStyleSettingProvider: LanguageCodeStyleSettingsProvider() { + + override fun getLanguage(): Language = FirebaseRulesLanguage + + override fun getCodeSample(settingsType: SettingsType): String = LANGUAGE_DEMO_TEXT + + override fun customizeSettings(consumer: CodeStyleSettingsCustomizable, settingsType: SettingsType) { + if (settingsType == SettingsType.SPACING_SETTINGS) { + consumer.showStandardOptions("SPACE_AFTER_COMMA") + consumer.showStandardOptions("SPACE_BEFORE_COMMA") + } else if (settingsType == SettingsType.BLANK_LINES_SETTINGS) { + consumer.showStandardOptions("KEEP_BLANK_LINES_IN_CODE") + } + } + + override fun customizeDefaults(commonSettings: CommonCodeStyleSettings, indentOptions: CommonCodeStyleSettings.IndentOptions) { + indentOptions.INDENT_SIZE = 4 + commonSettings.KEEP_BLANK_LINES_IN_CODE = 0 + } + + override fun getIndentOptionsEditor(): IndentOptionsEditor = SmartIndentOptionsEditor() +} \ No newline at end of file diff --git a/src/main/kotlin/co/anbora/labs/firebase/lang/FirebaseFileType.kt b/src/main/kotlin/co/anbora/labs/firebase/lang/FirebaseFileType.kt index fd52a34..0670ee0 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/lang/FirebaseFileType.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/lang/FirebaseFileType.kt @@ -1,14 +1,15 @@ package co.anbora.labs.firebase.lang import co.anbora.labs.firebase.ide.icons.FirebaseIcons +import co.anbora.labs.firebase.lang.FirebaseRulesLanguage.LANGUAGE_NAME import com.intellij.openapi.fileTypes.LanguageFileType import javax.swing.Icon object FirebaseFileType: LanguageFileType(FirebaseRulesLanguage) { - const val EXTENSION = "rules" + private const val EXTENSION = "rules" - override fun getName(): String = "Firebase Rules" + override fun getName(): String = LANGUAGE_NAME override fun getDescription(): String = "Firebase rules configurations" diff --git a/src/main/kotlin/co/anbora/labs/firebase/lang/FirebaseRulesLanguage.kt b/src/main/kotlin/co/anbora/labs/firebase/lang/FirebaseRulesLanguage.kt index 8315465..2f2f3cc 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/lang/FirebaseRulesLanguage.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/lang/FirebaseRulesLanguage.kt @@ -2,4 +2,40 @@ package co.anbora.labs.firebase.lang import com.intellij.lang.Language -object FirebaseRulesLanguage: Language("firebase_rules") +object FirebaseRulesLanguage: Language("firebase_rules") { + + const val LANGUAGE_NAME = "Firebase Rules" + + const val LANGUAGE_DEMO_TEXT = + """rules_version = '2'; +service cloud.firestore { + // Allow the requestor to read or delete any resource on a path under the + // user directory. + match /users/{userId}/{anyUserFile=**} { + allow read, delete: if request.auth != null && request.auth.uid == userId; + } + + match /databases/{database}/documents { + // True if the user is signed in or the requested data is 'public' + function signedInOrPublic() { + return request.auth.uid != null || resource.data.visibility == 'public'; + } + match /{role}/{document=**} { + allow read, write: if + request.time < timestamp.date(2020, 9, 23) && role in request.auth.token.authorities; + } + } + // Allow the requestor to create or update their own images. + // When 'request.method' == 'delete' this rule and the one matching + // any path under the user directory would both match and the `delete` + // would be permitted. + + match /users/{userId}/images/{imageId} { + // Whether to permit the request depends on the logical OR of all + // matched rules. This means that even if this rule did not explicitly + // allow the 'delete' the earlier rule would have. + allow write: if request.auth != null && request.auth.uid == userId && imageId.matches('*.png'); + } +}""" + +} diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 2adc276..8dd9050 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -22,6 +22,10 @@ + + From 74069f586ab74e3d59e88b2a2ca1525655b27652 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 8 Jun 2021 01:08:10 +0000 Subject: [PATCH 3/3] Restyled by whitespace --- .../co/anbora/labs/firebase/ide/formatter/FirebaseFmtContext.kt | 2 +- .../co/anbora/labs/firebase/ide/formatter/impl/alignment.kt | 2 +- .../co/anbora/labs/firebase/ide/formatter/impl/spacing.kt | 2 +- .../kotlin/co/anbora/labs/firebase/ide/formatter/impl/utils.kt | 2 +- .../labs/firebase/ide/style/FirebaseCodeStyleConfigurable.kt | 2 +- .../labs/firebase/ide/style/FirebaseCodeStyleMainPanel.kt | 2 +- .../anbora/labs/firebase/ide/style/FirebaseCodeStyleSettings.kt | 2 +- .../firebase/ide/style/FirebaseCodeStyleSettingsProvider.kt | 2 +- .../ide/style/FirebaseLanguageCodeStyleSettingProvider.kt | 2 +- .../kotlin/co/anbora/labs/firebase/lang/FirebaseFileType.kt | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFmtContext.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFmtContext.kt index b6301d7..79e3de1 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFmtContext.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/FirebaseFmtContext.kt @@ -16,4 +16,4 @@ data class FirebaseFmtContext private constructor( } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/alignment.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/alignment.kt index 947b6af..298e08c 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/alignment.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/alignment.kt @@ -16,4 +16,4 @@ fun FirebaseFormatterBlock.getAlignmentStrategy(): FirebaseAlignmentStrategy = w } fun FirebaseAlignmentStrategy.alignUnlessBlockDelim(): FirebaseAlignmentStrategy = - alignIf { c, p, _ -> !c.isDelimiterOfCurrentBlock(p) } \ No newline at end of file + alignIf { c, p, _ -> !c.isDelimiterOfCurrentBlock(p) } diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/spacing.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/spacing.kt index 25e0e62..6c90e26 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/spacing.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/spacing.kt @@ -42,4 +42,4 @@ fun createSpacingBuilder(commonSettings: CodeStyleSettings): SpacingBuilder { .after(EQEQ).spacing(1, 1, 0, false, 0) .after(NE).spacing(1, 1, 0, false, 0) .before(DOT_COMMA).spacing(0,0,0,false,0) -} \ No newline at end of file +} diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/utils.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/utils.kt index dbe97fd..c68e269 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/utils.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/formatter/impl/utils.kt @@ -31,4 +31,4 @@ fun ASTNode.isDelimiterOfCurrentBlock(parent: ASTNode?): Boolean { LP, RP -> parentType in PAREN_DELIMITED_BLOCKS else -> false } -} \ No newline at end of file +} diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleConfigurable.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleConfigurable.kt index 4cdfe0d..d6b1695 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleConfigurable.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleConfigurable.kt @@ -15,4 +15,4 @@ class FirebaseCodeStyleConfigurable( ): CodeStyleAbstractPanel = FirebaseCodeStyleMainPanel(currentSettings, settings) override fun getHelpTopic(): String? = null -} \ No newline at end of file +} diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleMainPanel.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleMainPanel.kt index db4289f..2693728 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleMainPanel.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleMainPanel.kt @@ -13,4 +13,4 @@ class FirebaseCodeStyleMainPanel( addIndentOptionsTab(settings) addSpacesTab(settings) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettings.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettings.kt index 4d16eb3..41bcacc 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettings.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettings.kt @@ -5,4 +5,4 @@ import com.intellij.psi.codeStyle.CustomCodeStyleSettings class FirebaseCodeStyleSettings( container: CodeStyleSettings? -): CustomCodeStyleSettings("FirebaseCodeStyleSettings", container) \ No newline at end of file +): CustomCodeStyleSettings("FirebaseCodeStyleSettings", container) diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettingsProvider.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettingsProvider.kt index 510533b..d11820b 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettingsProvider.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseCodeStyleSettingsProvider.kt @@ -18,4 +18,4 @@ object FirebaseCodeStyleSettingsProvider: CodeStyleSettingsProvider() { settings: CodeStyleSettings, originalSettings: CodeStyleSettings? ): Configurable = FirebaseCodeStyleConfigurable(settings, originalSettings) -} \ No newline at end of file +} diff --git a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseLanguageCodeStyleSettingProvider.kt b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseLanguageCodeStyleSettingProvider.kt index 3590b8c..ef2d3cf 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseLanguageCodeStyleSettingProvider.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/ide/style/FirebaseLanguageCodeStyleSettingProvider.kt @@ -30,4 +30,4 @@ object FirebaseLanguageCodeStyleSettingProvider: LanguageCodeStyleSettingsProvid } override fun getIndentOptionsEditor(): IndentOptionsEditor = SmartIndentOptionsEditor() -} \ No newline at end of file +} diff --git a/src/main/kotlin/co/anbora/labs/firebase/lang/FirebaseFileType.kt b/src/main/kotlin/co/anbora/labs/firebase/lang/FirebaseFileType.kt index 0670ee0..ddcb8a0 100644 --- a/src/main/kotlin/co/anbora/labs/firebase/lang/FirebaseFileType.kt +++ b/src/main/kotlin/co/anbora/labs/firebase/lang/FirebaseFileType.kt @@ -17,4 +17,4 @@ object FirebaseFileType: LanguageFileType(FirebaseRulesLanguage) { override fun getIcon(): Icon = FirebaseIcons.FILE -} \ No newline at end of file +}