From 509491b0a43fd04bedf4b3cb199874011c2695c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Mon, 19 May 2025 14:44:37 +0200 Subject: [PATCH] code_completion.md: Skipping Completion Popup - mention inverse case --- .../custom_language_support/code_completion.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/topics/reference_guide/custom_language_support/code_completion.md b/topics/reference_guide/custom_language_support/code_completion.md index 4d9df2b91..4a5b76648 100644 --- a/topics/reference_guide/custom_language_support/code_completion.md +++ b/topics/reference_guide/custom_language_support/code_completion.md @@ -14,7 +14,7 @@ Two types of code completion can be provided by custom language plugins: reference completion and contributor-based completion. -Reference completion is easier to implement, but supports only the basic completion action. +Reference completion is easier to implement but supports only the basic completion action. Contributor-based completion provides more features, supports all completion types (Code | Code Completion | Basic and Type Matching), @@ -45,7 +45,7 @@ To provide completion variants by a `PsiSymbolReference` implement ## Contributor-Based Completion Implementing [`CompletionContributor`](%gh-ic%/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionContributor.java) gives the greatest control over the operation of code completion. -Register in and specify `language` attribute (unless it works on any supported language). +Register in and specify the `language` attribute (unless it works on any supported language). > Note that the Javadoc of that class contains a detailed FAQ for implementing code completion. > @@ -102,7 +102,7 @@ Example: add parentheses for a method call ([`ParenthesesInsertHandler`](%gh-ic% The item presentation can also be performed via (re-usable) [`LookupElementRenderer`](%gh-ic%/platform/analysis-api/src/com/intellij/codeInsight/lookup/LookupElementRenderer.java). -For expensive calculations (for example, the presentation of an item to be shown depends on other items) use `LookupElementBuilder.withExpensiveRenderer()` to invoke the renderer in the background +For expensive calculations (for example, the presentation of an item to be shown depends on other items), use `LookupElementBuilder.withExpensiveRenderer()` to invoke the renderer in the background while the completion list is already populating. ### Sorting @@ -114,9 +114,11 @@ if _all_ lookup items are guaranteed to be provided by this `CompletionContribut ### Skipping Completion Popup -To skip completion popup in the current context (for example, inside comments), implement [`CompletionConfidence`](%gh-ic%/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionConfidence.java) +To skip the completion popup in the current context (for example, inside comments), implement [`CompletionConfidence`](%gh-ic%/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionConfidence.java) registered in . +This can also be used to _prevent_ skipping provided by other plugins by returning `ThreeState.NO` and registering the extension with `order="first"`. + ### Showing Completion Popup Programmatically To trigger completion upon typing a specific character in the editor, override