-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from londonbrown/master
Support 2022.2
- Loading branch information
Showing
9 changed files
with
56 additions
and
12 deletions.
There are no files selected for viewing
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
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
34 changes: 34 additions & 0 deletions
34
src/IC-222/kotlin/com/amazon/ion/plugin/intellij/formatting/IonFormattingModelBuilder.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,34 @@ | ||
package com.amazon.ion.plugin.intellij.formatting | ||
|
||
import com.amazon.ion.plugin.intellij.formatting.blocks.IonBlockOptions | ||
import com.amazon.ion.plugin.intellij.formatting.blocks.RootIonBlock | ||
import com.intellij.formatting.FormattingContext | ||
import com.intellij.formatting.FormattingModel | ||
import com.intellij.formatting.FormattingModelBuilder | ||
import com.intellij.formatting.FormattingModelProvider | ||
|
||
/** | ||
* Creates the block model for an Ion file. | ||
* | ||
* The block model will determine how elements are spaced, indented and aligned. | ||
*/ | ||
class IonFormattingModelBuilder : FormattingModelBuilder { | ||
override fun createModel(formattingContext: FormattingContext): FormattingModel { | ||
val element = formattingContext.psiElement | ||
val settings = formattingContext.codeStyleSettings | ||
|
||
val rootBlock = RootIonBlock( | ||
node = element.node, | ||
options = IonBlockOptions( | ||
spaceBuilder = IonCodeBlockSpacingProvider(settings), | ||
codeStyle = settings | ||
) | ||
) | ||
|
||
|
||
return FormattingModelProvider.createFormattingModelForPsiFile( | ||
element.containingFile, | ||
rootBlock, settings | ||
) | ||
} | ||
} |
Empty file.
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