Changed workaround according to recommendation by Jetbrains.

This commit is contained in:
2022-08-17 20:28:18 +02:00
parent 1ee532b577
commit f3bc2c1a0b
3 changed files with 4 additions and 10 deletions
@@ -56,14 +56,8 @@ class JoinStatementsQuickFix(private val separateLineLimit: Int) : AbstractCommo
}
private fun addLineBreak(project: Project, lastElementBeforeConcat: PsiElement) {
val newLineNode = try {
PsiParserFacade.getInstance(project).createWhiteSpaceFromText("\n\t")
} catch (ex: NoSuchMethodError) {
// scheduled for removal, but alternate version not even available in 2020.3.
// So keep it here until we run into a problem.
// Changing the min version from 2017.3 to 2021.x is a major thing.
PsiParserFacade.SERVICE.getInstance(project).createWhiteSpaceFromText("\n\t")
}
// was PsiParserFacade.getInstance(project).createWhiteSpaceFromText("\n\t"), changed due to breaking API changes
val newLineNode = project.getService(PsiParserFacade::class.java).createWhiteSpaceFromText("\n\t")
lastElementBeforeConcat.addAfter(newLineNode, lastElementBeforeConcat.firstChild)
}