mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[formatter-core] minor, signature change
This commit is contained in:
@@ -56,23 +56,23 @@ interface BlockProcessor {
|
||||
}
|
||||
|
||||
class AdditionalRangesExtractor : BlockProcessor {
|
||||
val extraRanges = mutableListOf<ExtraReformatRanges>()
|
||||
|
||||
val additionalRanges = mutableListOf<TextRange>()
|
||||
|
||||
override fun processLeafBlock(block: Block) {
|
||||
extractAdditionalRange(block)
|
||||
}
|
||||
override fun processLeafBlock(block: Block) = Unit
|
||||
|
||||
override fun processCompositeBlock(block: Block) {
|
||||
extractAdditionalRange(block)
|
||||
}
|
||||
|
||||
private fun extractAdditionalRange(block: Block) {
|
||||
if (block is AbstractBlock) {
|
||||
block.extraRangeToReformat?.let { additionalRanges.add(it) }
|
||||
block.extraRangesToFormat?.let { extraRanges.add(it) }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ExtraReformatRanges(val ranges: List<TextRange> = emptyList()) {
|
||||
constructor(range: TextRange): this(listOf(range))
|
||||
}
|
||||
|
||||
fun FormatTextRanges.mergeWith(extraRanges: ExtraReformatRanges) {
|
||||
extraRanges.ranges.forEach { add(it, false) }
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class AdjustFormatRangesState(var currentRoot: Block,
|
||||
|
||||
init {
|
||||
setOnDone({
|
||||
extractor.additionalRanges.forEach { formatRanges.add(it, true) }
|
||||
extractor.extraRanges.forEach { formatRanges.mergeWith(it) }
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ public abstract class AbstractBlock implements ASTBlock {
|
||||
* @return additional range to reformat, when this block if formatted
|
||||
*/
|
||||
@Nullable
|
||||
public TextRange getExtraRangeToReformat() {
|
||||
public ExtraReformatRanges getExtraRangesToFormat() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user