Store project to avoid creating psi factory from invalid element
Fix ConvertLineCommentToBlockCommentIntention tests
This commit is contained in:
+2
-1
@@ -23,6 +23,7 @@ class ConvertLineCommentToBlockCommentIntention : SelfTargetingIntention<PsiComm
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun applyTo(element: PsiComment, editor: Editor?) {
|
override fun applyTo(element: PsiComment, editor: Editor?) {
|
||||||
|
val project = element.project
|
||||||
var firstComment = element
|
var firstComment = element
|
||||||
while (true) {
|
while (true) {
|
||||||
firstComment = firstComment.prevComment() ?: break
|
firstComment = firstComment.prevComment() ?: break
|
||||||
@@ -48,7 +49,7 @@ class ConvertLineCommentToBlockCommentIntention : SelfTargetingIntention<PsiComm
|
|||||||
(it.prevSibling as? PsiWhiteSpace)?.delete()
|
(it.prevSibling as? PsiWhiteSpace)?.delete()
|
||||||
it.delete()
|
it.delete()
|
||||||
}
|
}
|
||||||
firstComment.replace(KtPsiFactory(element).createComment(blockComment))
|
firstComment.replace(KtPsiFactory(project).createComment(blockComment))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user