Fix compilation for 183 after adding support incremental analysis of comment and kdoc
Relates to #KT-35189
This commit is contained in:
+9
-8
@@ -197,23 +197,24 @@ class KotlinCodeBlockModificationListener(
|
|||||||
return inBlockElements.isNotEmpty()
|
return inBlockElements.isNotEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isFormattingChange(changeSet: TreeChangeEvent): Boolean =
|
private fun isCommentChange(changeSet: TreeChangeEvent): Boolean =
|
||||||
changeSet.changedElements.all {
|
|
||||||
changeSet.getChangesByElement(it).affectedChildren.all { c -> c is PsiWhiteSpace }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun isCommentChange(changeSet: TreeChangeEvent): Boolean =
|
|
||||||
changeSet.changedElements.all { changedElement ->
|
changeSet.changedElements.all { changedElement ->
|
||||||
val changesByElement = changeSet.getChangesByElement(changedElement)
|
val changesByElement = changeSet.getChangesByElement(changedElement)
|
||||||
changesByElement.affectedChildren.all { affectedChild ->
|
changesByElement.affectedChildren.all { affectedChild ->
|
||||||
|
if (!(affectedChild is PsiComment || affectedChild is KDoc)) return@all false
|
||||||
val changeByChild = changesByElement.getChangeByChild(affectedChild)
|
val changeByChild = changesByElement.getChangeByChild(affectedChild)
|
||||||
return@all if (changeByChild is ChangeInfoImpl) {
|
return@all if (changeByChild is ChangeInfoImpl) {
|
||||||
changeByChild.oldChild is PsiComment && changeByChild.newChild is PsiComment ||
|
val oldChild = changeByChild.oldChild
|
||||||
changeByChild.oldChild is KDoc && changeByChild.newChild is KDoc
|
oldChild is PsiComment || oldChild is KDoc
|
||||||
} else false
|
} else false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun isFormattingChange(changeSet: TreeChangeEvent): Boolean =
|
||||||
|
changeSet.changedElements.all {
|
||||||
|
changeSet.getChangesByElement(it).affectedChildren.all { c -> c is PsiWhiteSpace }
|
||||||
|
}
|
||||||
|
|
||||||
fun getInsideCodeBlockModificationScope(element: PsiElement): BlockModificationScopeElement? {
|
fun getInsideCodeBlockModificationScope(element: PsiElement): BlockModificationScopeElement? {
|
||||||
val lambda = element.getTopmostParentOfType<KtLambdaExpression>()
|
val lambda = element.getTopmostParentOfType<KtLambdaExpression>()
|
||||||
if (lambda is KtLambdaExpression) {
|
if (lambda is KtLambdaExpression) {
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// OUT_OF_CODE_BLOCK: FALSE
|
||||||
|
// TYPE: '\b\b'
|
||||||
|
|
||||||
|
fun uncomment(): String {
|
||||||
|
//<caret>return ""
|
||||||
|
}
|
||||||
+5
@@ -348,6 +348,11 @@ public class OutOfBlockModificationTestGenerated extends AbstractOutOfBlockModif
|
|||||||
runTest("idea/testData/codeInsight/outOfBlock/StringInSuperConstroctorCall.kt");
|
runTest("idea/testData/codeInsight/outOfBlock/StringInSuperConstroctorCall.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("Uncomment.kt")
|
||||||
|
public void testUncomment() throws Exception {
|
||||||
|
runTest("idea/testData/codeInsight/outOfBlock/Uncomment.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("WholeFileChanged.kt")
|
@TestMetadata("WholeFileChanged.kt")
|
||||||
public void testWholeFileChanged() throws Exception {
|
public void testWholeFileChanged() throws Exception {
|
||||||
runTest("idea/testData/codeInsight/outOfBlock/WholeFileChanged.kt");
|
runTest("idea/testData/codeInsight/outOfBlock/WholeFileChanged.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user