Make constructor parameter a property: message shortened a bit
(cherry picked from commit 1938909)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
e51f2457bf
commit
0278a6c8a4
@@ -35,10 +35,12 @@ import org.jetbrains.kotlin.psi.psiUtil.nonStaticOuterClasses
|
||||
class MakeConstructorParameterPropertyFix(
|
||||
element: KtParameter, private val kotlinValVar: KotlinValVar, className: String?
|
||||
) : KotlinQuickFixAction<KtParameter>(element) {
|
||||
override fun getFamilyName() = "Make primary constructor parameter a property"
|
||||
override fun getFamilyName() = "Make constructor parameter a property"
|
||||
|
||||
private val suffix = if (className != null) " in class '$className'" else ""
|
||||
override fun getText() = "Make primary constructor parameter '${element.name}' a property" + suffix
|
||||
|
||||
override fun getText() =
|
||||
"Make constructor parameter a property$suffix"
|
||||
|
||||
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile): Boolean {
|
||||
return super.isAvailable(project, editor, file) && !element.hasValOrVar()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Make primary constructor parameter 'bar' a property in class 'B'" "true"
|
||||
// "Make constructor parameter a property in class 'B'" "true"
|
||||
|
||||
class B(bar: String) {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Make primary constructor parameter 'bar' a property in class 'B'" "true"
|
||||
// "Make constructor parameter a property in class 'B'" "true"
|
||||
|
||||
class B(private val bar: String) {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Make primary constructor parameter 'foo' a property" "true"
|
||||
// "Make constructor parameter a property" "true"
|
||||
|
||||
class A(foo: String) {
|
||||
fun bar() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Make primary constructor parameter 'foo' a property" "true"
|
||||
// "Make constructor parameter a property" "true"
|
||||
|
||||
class A(private val foo: String) {
|
||||
fun bar() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Make primary constructor parameter 'foo' a property" "true"
|
||||
// "Make constructor parameter a property" "true"
|
||||
|
||||
class A(foo: String) {
|
||||
fun bar() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Make primary constructor parameter 'foo' a property" "true"
|
||||
// "Make constructor parameter a property" "true"
|
||||
|
||||
class A(private var foo: String) {
|
||||
fun bar() {
|
||||
|
||||
Reference in New Issue
Block a user