FIR IDE: Add simple types importing

Some tests are not passing
This commit is contained in:
Roman Golyshev
2020-12-22 15:34:21 +03:00
committed by Space
parent 0609aa1e2e
commit e34370554d
17 changed files with 205 additions and 34 deletions
@@ -5,27 +5,12 @@
package org.jetbrains.kotlin.idea.frontend.api.components
import com.intellij.openapi.application.ApplicationManager
import com.intellij.psi.SmartPsiElementPointer
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtUserType
abstract class KtReferenceShortener : KtAnalysisSessionComponent() {
abstract fun collectShortenings(file: KtFile, from: Int, to: Int): ShortenCommand
}
class ShortenCommand(
val targetFile: KtFile,
val importsToAdd: List<FqName>,
val typesToShorten: List<SmartPsiElementPointer<KtUserType>>
) {
fun invokeShortening() {
ApplicationManager.getApplication().assertWriteAccessAllowed()
for (typePointer in typesToShorten) {
val type = typePointer.element ?: continue
type.deleteQualifier()
}
}
interface ShortenCommand {
fun invokeShortening()
}