diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/commands/JavaCommandsCompletionTest.kt b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/commands/JavaCommandsCompletionTest.kt index 12c791912738..0c6d2ff5e4fe 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/commands/JavaCommandsCompletionTest.kt +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/commands/JavaCommandsCompletionTest.kt @@ -215,7 +215,10 @@ class JavaCommandsCompletionTest : LightFixtureCompletionTestCase() { } """.trimIndent()) val elements = myFixture.completeBasic() - selectItem(elements.first { element -> element.lookupString.contains("copy ref", ignoreCase = true) }) + val item = elements.first { element -> element.lookupString.contains("copy ref", ignoreCase = true) } + val preview = (item.`as`(CommandCompletionLookupElement::class.java))?.preview + assertEquals("Copy reference for 'foo'.", (preview as IntentionPreviewInfo.Html).content().toString()) + selectItem(item) myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PASTE) NonBlockingReadActionImpl.waitForAsyncTaskCompletion() myFixture.checkResult(""" diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/command/commands/AbstractActionCompletionCommand.kt b/platform/lang-impl/src/com/intellij/codeInsight/completion/command/commands/AbstractActionCompletionCommand.kt index bde432cc9f5b..870d95df4eea 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/command/commands/AbstractActionCompletionCommand.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/command/commands/AbstractActionCompletionCommand.kt @@ -238,8 +238,12 @@ open class ActionCompletionCommand( } override fun getPreview(): IntentionPreviewInfo { - if (previewText == null) return IntentionPreviewInfo.EMPTY - return IntentionPreviewInfo.Html(previewText) + var contentHtml = previewText + if (contentHtml == null) return IntentionPreviewInfo.EMPTY + if (!contentHtml.endsWith(".")) { + contentHtml = "$contentHtml." + } + return IntentionPreviewInfo.Html(contentHtml) } }