FIR IDE: add action to override/implement missing members

This commit adds the following actions:

- quickfix to implement missing members
- quickfix to implement missing members as constructor parameters
- action to implement members (Code - Generate - Implement)
- action to override members (Code - Generate - Override)

The current implementation is still missing some pieces, which will be
addressed in future changes.

- fully qualified names are not shorten
- some Kotlin types are not rendered correctly
This commit is contained in:
Tianyu Geng
2021-04-13 21:42:56 -07:00
committed by TeamCityServer
parent 34387e228f
commit 00031c8eb1
32 changed files with 1454 additions and 231 deletions
@@ -0,0 +1,34 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.util
/** Implementation status of a member symbol that is available inside a class scope. */
enum class ImplementationStatus {
/** This symbol is not implemented and should be implemented if the class is not abstract. */
NOT_IMPLEMENTED,
/** The symbol is inheriting multiple non-abstract symbols and hence must be explicitly implemented. */
AMBIGUOUSLY_INHERITED,
/**
* This symbol has an inherited implementation, and it can be overridden if desired. For example, it's an open non-abstract member or
* it's automatically synthesized by the Kotlin compiler.
*/
INHERITED_OR_SYNTHESIZED,
/** The symbol is already implemented in this class. */
ALREADY_IMPLEMENTED,
/**
* The symbol is not implemented in the class and it cannot be implemented. For example, it's final in super classes or the current
* class is `expect`.
*/
CANNOT_BE_IMPLEMENTED;
val shouldBeImplemented: Boolean get() = this == NOT_IMPLEMENTED || this == AMBIGUOUSLY_INHERITED
val isOverridable: Boolean get() = this != ALREADY_IMPLEMENTED && this != CANNOT_BE_IMPLEMENTED
}