Skip to content

Commit

Permalink
[ #20 #21 ] comma after FUNCTION_SIGNATURE
Browse files Browse the repository at this point in the history
  • Loading branch information
zxj5470 committed Feb 22, 2018
1 parent 602e0fa commit 384de17
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/org/ice1000/julia/lang/editing/julia-format.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.intellij.openapi.util.TextRange
import com.intellij.psi.*
import com.intellij.psi.codeStyle.CodeStyleSettings
import com.intellij.psi.formatter.common.AbstractBlock
import com.intellij.psi.tree.TokenSet
import org.ice1000.julia.lang.JuliaLanguage
import org.ice1000.julia.lang.psi.JuliaTypes
import java.util.*
Expand Down Expand Up @@ -49,15 +50,15 @@ class JuliaFormattingModelBuilder : FormattingModelBuilder {
// val codeStyleSettings = settings.getCustomSettings(JuliaCodeStyleSettings::class.java)
// val commonSettings = settings.getCommonSettings(JsonLanguage.INSTANCE)
// val spacesAroundAssign = if (commonSettings.SPACE_AROUND_ASSIGNMENT_OPERATORS) 1 else 0
val tokenSetForCommaAndSemi=TokenSet.create(JuliaTypes.COMMA_SYM,JuliaTypes.SEMICOLON_SYM)
return SpacingBuilder(settings, JuliaLanguage.INSTANCE)
.around(JuliaTypes.ASSIGN_LEVEL_OPERATOR).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
.around(JuliaTypes.COMPARISON_LEVEL_OPERATOR).spaces(1)
.around(JuliaTypes.ARROW_SYM).spaces(1)
.around(JuliaTypes.EQ_SYM).spaces(1)
.afterInside(JuliaTypes.COMMA_SYM, JuliaTypes.EXPRESSION_LIST).spaces(1)
.afterInside(JuliaTypes.SEMICOLON_SYM, JuliaTypes.EXPRESSION_LIST).spaces(1)
.afterInside(JuliaTypes.COMMA_SYM, JuliaTypes.ARRAY).spaces(1)
.afterInside(JuliaTypes.SEMICOLON_SYM, JuliaTypes.ARRAY).spaces(1)
.afterInside(tokenSetForCommaAndSemi, JuliaTypes.EXPRESSION_LIST).spaces(1)
.afterInside(tokenSetForCommaAndSemi, JuliaTypes.ARRAY).spaces(1)
.afterInside(tokenSetForCommaAndSemi, JuliaTypes.FUNCTION_SIGNATURE).spaces(1)
}

override fun getRangeAffectingIndent(file: PsiFile, offset: Int, elementAtOffset: ASTNode): TextRange? {
Expand Down

0 comments on commit 384de17

Please sign in to comment.