From c042af87335fa5a48640663c4ac33e42d5fd04b7 Mon Sep 17 00:00:00 2001 From: Mikhail Pyltsin Date: Thu, 20 Nov 2025 09:48:20 +0100 Subject: [PATCH] [command-completion] IDEA-381060 Command completion preview descriptions should end with a period GitOrigin-RevId: bba450771087349c1b60ea39901aa4ef60c55e2e --- .../completion/commands/JavaCommandsCompletionTest.kt | 5 ++++- .../command/commands/AbstractActionCompletionCommand.kt | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) 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) } }