i18n: add bundle for idea-completion
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
exclude.0.from.completion=Exclude '{0}' from completion
|
||||||
|
insert.lambda.template=Insert lambda template
|
||||||
|
presentation.tail.for.0=\ for {0}
|
||||||
|
presentation.tail.for.0.in.1=\ for {0} in {1}
|
||||||
|
presentation.tail.from.0=\ (from {0})
|
||||||
|
presentation.tail.in.0=in {0}
|
||||||
+7
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2020 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -482,7 +482,12 @@ class BasicCompletionSession(
|
|||||||
|
|
||||||
override fun renderElement(presentation: LookupElementPresentation?) {
|
override fun renderElement(presentation: LookupElementPresentation?) {
|
||||||
super.renderElement(presentation)
|
super.renderElement(presentation)
|
||||||
presentation?.appendTailText(" for $name in $packageName", true)
|
presentation?.appendTailText(
|
||||||
|
KotlinIdeaCompletionBundle.message(
|
||||||
|
"presentation.tail.for.0.in.1",
|
||||||
|
name,
|
||||||
|
packageName
|
||||||
|
), true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
+4
-4
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2020 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -294,12 +294,12 @@ class BasicLookupElementFactory(
|
|||||||
is SyntheticJavaPropertyDescriptor -> {
|
is SyntheticJavaPropertyDescriptor -> {
|
||||||
var from = descriptor.getMethod.name.asString() + "()"
|
var from = descriptor.getMethod.name.asString() + "()"
|
||||||
descriptor.setMethod?.let { from += "/" + it.name.asString() + "()" }
|
descriptor.setMethod?.let { from += "/" + it.name.asString() + "()" }
|
||||||
appendTailText(" (from $from)")
|
appendTailText(KotlinIdeaCompletionBundle.message("presentation.tail.from.0", from))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
val receiverPresentation = SHORT_NAMES_RENDERER.renderType(extensionReceiver.type)
|
val receiverPresentation = SHORT_NAMES_RENDERER.renderType(extensionReceiver.type)
|
||||||
appendTailText(" for $receiverPresentation")
|
appendTailText(KotlinIdeaCompletionBundle.message("presentation.tail.for.0", receiverPresentation))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -323,7 +323,7 @@ class BasicLookupElementFactory(
|
|||||||
is PackageFragmentDescriptor -> container.fqName.toString()
|
is PackageFragmentDescriptor -> container.fqName.toString()
|
||||||
else -> return null
|
else -> return null
|
||||||
}
|
}
|
||||||
return "in $containerPresentation"
|
return KotlinIdeaCompletionBundle.message("presentation.tail.in.0", containerPresentation)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2020 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.
|
* 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.idea.completion
|
package org.jetbrains.kotlin.idea.completion
|
||||||
@@ -34,7 +34,7 @@ class KotlinExcludeFromCompletionLookupActionProvider : LookupActionProvider {
|
|||||||
private class ExcludeFromCompletionAction(
|
private class ExcludeFromCompletionAction(
|
||||||
private val project: Project,
|
private val project: Project,
|
||||||
private val exclude: String
|
private val exclude: String
|
||||||
) : LookupElementAction(null, "Exclude '$exclude' from completion") {
|
) : LookupElementAction(null, KotlinIdeaCompletionBundle.message("exclude.0.from.completion", exclude)) {
|
||||||
override fun performLookupAction(): Result {
|
override fun performLookupAction(): Result {
|
||||||
AddImportAction.excludeFromImport(project, exclude)
|
AddImportAction.excludeFromImport(project, exclude)
|
||||||
return Result.HIDE_LOOKUP
|
return Result.HIDE_LOOKUP
|
||||||
|
|||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 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.idea.completion
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NonNls
|
||||||
|
import org.jetbrains.annotations.PropertyKey
|
||||||
|
import org.jetbrains.kotlin.util.AbstractKotlinBundle
|
||||||
|
|
||||||
|
@NonNls
|
||||||
|
private const val BUNDLE = "messages.KotlinIdeaCompletionBundle"
|
||||||
|
|
||||||
|
object KotlinIdeaCompletionBundle : AbstractKotlinBundle(BUNDLE) {
|
||||||
|
@JvmStatic
|
||||||
|
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
|
||||||
|
}
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2020 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ object LambdaSignatureTemplates {
|
|||||||
) {
|
) {
|
||||||
// we start template later to not interfere with insertion of tail type
|
// we start template later to not interfere with insertion of tail type
|
||||||
val commandProcessor = CommandProcessor.getInstance()
|
val commandProcessor = CommandProcessor.getInstance()
|
||||||
val commandName = commandProcessor.currentCommandName ?: "Insert lambda template"
|
val commandName = commandProcessor.currentCommandName ?: KotlinIdeaCompletionBundle.message("insert.lambda.template")
|
||||||
val commandGroupId = commandProcessor.currentCommandGroupId
|
val commandGroupId = commandProcessor.currentCommandGroupId
|
||||||
|
|
||||||
val rangeMarker = context.document.createRangeMarker(placeholderRange)
|
val rangeMarker = context.document.createRangeMarker(placeholderRange)
|
||||||
|
|||||||
Reference in New Issue
Block a user