New J2K: Temporary ignore imports & error comments
This commit is contained in:
committed by
Ilya Kirillov
parent
bcee73ff01
commit
6f7f516a4f
@@ -11,20 +11,24 @@ import com.intellij.psi.PsiElementVisitor
|
|||||||
import com.intellij.psi.PsiWhiteSpace
|
import com.intellij.psi.PsiWhiteSpace
|
||||||
import com.intellij.psi.impl.source.tree.LeafPsiElement
|
import com.intellij.psi.impl.source.tree.LeafPsiElement
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
|
import org.jetbrains.kotlin.psi.KtImportDirective
|
||||||
|
|
||||||
internal fun KtFile.dumpStructureText(): String {
|
internal fun KtFile.dumpStructureText(): String {
|
||||||
val sb = StringBuilder()
|
val sb = StringBuilder()
|
||||||
this.accept(object : PsiElementVisitor() {
|
this.accept(object : PsiElementVisitor() {
|
||||||
override fun visitElement(element: PsiElement?) {
|
override fun visitElement(element: PsiElement?) {
|
||||||
if (element is PsiComment) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (element is PsiWhiteSpace) {
|
if (element is PsiWhiteSpace) {
|
||||||
if (sb.lastOrNull() !in listOf(' ', '{', '}', '(', ')')) {
|
if (sb.lastOrNull() !in listOf(' ', '{', '}', '(', ')')) {
|
||||||
sb.append(" ")
|
sb.append(" ")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (element is KtImportDirective) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (element is PsiComment && (element.text.startsWith("// ERROR") || element.text.startsWith("// !"))) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (element is LeafPsiElement) {
|
if (element is LeafPsiElement) {
|
||||||
sb.append(element.text)
|
sb.append(element.text)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user