add debug info
Part of #KT-22211
This commit is contained in:
+24
@@ -25,10 +25,34 @@ abstract class KotlinLikeLangLineIndentProvider : JavaLikeLangLineIndentProvider
|
||||
|
||||
override fun isSuitableForLanguage(language: Language): Boolean = language.isKindOf(KotlinLanguage.INSTANCE)
|
||||
|
||||
private fun debugInfo(currentPosition: SemanticEditorPosition): String {
|
||||
val after = currentPosition.after()
|
||||
val before = currentPosition.before()
|
||||
val chars = currentPosition.chars
|
||||
fun print(position: SemanticEditorPosition, next: SemanticEditorPosition? = null) = "${position.currElement} =>\n'${
|
||||
if (position.isAtEnd)
|
||||
"end"
|
||||
else
|
||||
chars.subSequence(position.startOffset, next?.takeIf { !it.isAtEnd }?.startOffset ?: chars.length)
|
||||
}'"
|
||||
|
||||
return "==\nbefore ${
|
||||
print(before, currentPosition)
|
||||
}\ncurr ${
|
||||
print(currentPosition, after)
|
||||
}\nafter ${
|
||||
print(after)
|
||||
}\n=="
|
||||
}
|
||||
|
||||
override fun getIndent(project: Project, editor: Editor, language: Language?, offset: Int): IndentCalculator? {
|
||||
val factory = IndentCalculatorFactory(project, editor)
|
||||
val currentPosition = getPosition(editor, offset)
|
||||
|
||||
// ~~~ TESTING ~~~
|
||||
// println(debugInfo(currentPosition))
|
||||
// ~~~ TESTING ~~~
|
||||
|
||||
currentPosition.beforeOptionalMix(Whitespace, LineComment)
|
||||
.takeIf { it.isAt(TemplateEntryOpen) }
|
||||
?.let { templateEntryPosition ->
|
||||
|
||||
Reference in New Issue
Block a user