From 66612629d60895303f0440dd95e2d0c640acdff8 Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Fri, 12 Jun 2026 13:10:41 +0200 Subject: [PATCH] IJPL-247511 Ability to switch new rd completion per editor (cherry picked from commit 224eefc45dc3b730edac9fedea2d41e50f9667ad) GitOrigin-RevId: 7a7bfb344a68d7544a8042d065e1bc73df85d334 --- .../editorActions/JavaTypedHandlerBase.java | 4 ++-- .../impl/DaemonRespondToChangesPerfTest.java | 6 ++--- .../resources/META-INF/Analysis.analyzer.xml | 1 + .../completion/CompletionContributor.java | 17 ++++++++++---- .../completion/CompletionResultSet.java | 4 ++-- .../completion/CompletionService.java | 4 ++-- .../completion/NewRdCompletionSupport.kt | 19 +++++++++++---- .../completion/NewRdCompletionVeto.kt | 23 +++++++++++++++++++ .../completion/group/GroupedCompletion.kt | 5 ++-- .../group/GroupedCompletionContributor.java | 6 +++-- .../CompletionInitializationUtil.java | 4 ++-- .../completion/group/GroupedCompletionImpl.kt | 5 ++-- .../codeInsight/completion/CompletionPhase.kt | 2 +- .../CompletionProgressIndicator.java | 6 ++--- .../actions/BaseCodeCompletionAction.java | 2 +- .../command/CommandCompletionProvider.kt | 2 +- .../ApplicationCommandCompletionService.kt | 2 +- .../CommandCompletionConfigurable.kt | 2 +- .../editorActions/TypedAutoPopupImpl.java | 2 +- .../PostfixTemplatesConfigurableUi.kt | 4 ++-- .../settings/PostfixTemplatesSettings.java | 2 +- 21 files changed, 85 insertions(+), 37 deletions(-) create mode 100644 platform/analysis-api/src/com/intellij/codeInsight/completion/NewRdCompletionVeto.kt diff --git a/java/java-frontback-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandlerBase.java b/java/java-frontback-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandlerBase.java index 0d7848a4efa1..c36f5c45d535 100644 --- a/java/java-frontback-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandlerBase.java +++ b/java/java-frontback-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandlerBase.java @@ -85,7 +85,7 @@ public class JavaTypedHandlerBase extends TypedHandlerDelegate { } protected void autoPopupMemberLookup(@NotNull Project project, @NotNull Editor editor) { - if (NewRdCompletionSupport.isFrontendRdCompletionOn()) { + if (NewRdCompletionSupport.isFrontendRdCompletionOn(editor)) { AutoPopupController.getInstance(project).scheduleAutoPopup(editor, new FrontendAutoPopupMemberLookupCondition(editor)); } } @@ -552,7 +552,7 @@ public class JavaTypedHandlerBase extends TypedHandlerDelegate { @Override public @NotNull Result checkAutoPopup(char charTyped, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { - if (NewRdCompletionSupport.isFrontendRdCompletionOn()) { + if (NewRdCompletionSupport.isFrontendRdCompletionOn(editor)) { return doCheckAutoPopup(charTyped, project, editor, file); } else { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesPerfTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesPerfTest.java index dbf5fa708eb1..06b57083b822 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesPerfTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesPerfTest.java @@ -1,4 +1,4 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2026 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.daemon.impl; import com.intellij.codeInsight.completion.CompletionContributor; @@ -122,7 +122,7 @@ public class DaemonRespondToChangesPerfTest extends ProductionDaemonAnalyzerTest @NonNls String filePath = "/psi/resolve/Thinlet.java"; configureByFile(filePath); type(' '); - CompletionContributor.forLanguage(getFile().getLanguage()); + CompletionContributor.forLanguage(getFile().getLanguage(), getEditor()); myTestDaemonCodeAnalyzer.waitHighlighting(getFile(), HighlightSeverity.ERROR); int N = Math.max(5, Timings.adjustAccordingToMySpeed(80, false)); @@ -219,7 +219,7 @@ public class DaemonRespondToChangesPerfTest extends ProductionDaemonAnalyzerTest configureByFile(filePath); type(' '); - CompletionContributor.forLanguage(getFile().getLanguage()); + CompletionContributor.forLanguage(getFile().getLanguage(), getEditor()); long s = System.currentTimeMillis(); myTestDaemonCodeAnalyzer.waitHighlighting(getFile(), HighlightSeverity.ERROR); if (DEBUG) { diff --git a/platform/analysis-api/resources/META-INF/Analysis.analyzer.xml b/platform/analysis-api/resources/META-INF/Analysis.analyzer.xml index 0293d8fa2d32..55d2225656d6 100644 --- a/platform/analysis-api/resources/META-INF/Analysis.analyzer.xml +++ b/platform/analysis-api/resources/META-INF/Analysis.analyzer.xml @@ -30,5 +30,6 @@ + diff --git a/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionContributor.java b/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionContributor.java index 2111777259c0..2d24fb3525e3 100644 --- a/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionContributor.java +++ b/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionContributor.java @@ -236,13 +236,22 @@ public abstract class CompletionContributor implements PossiblyDumbAware { return ReadAction.computeBlocking(() -> { PsiElement position = parameters.getPosition(); Language language = PsiUtilCore.getLanguageAtOffset(position.getContainingFile(), parameters.getOffset()); - return forLanguageHonorDumbness(language, position.getProject()); + return forLanguageHonorDumbness(language, position.getProject(), parameters.getEditor()); }); } + /** + * @deprecated Use {@link forLanguage(Language, Editor)} direcly + */ @ApiStatus.Internal + @Deprecated public static @NotNull List forLanguage(@NotNull Language language) { - boolean isRDFrontend = NewRdCompletionSupport.isFrontendRdCompletionOn() && PlatformUtils.isJetBrainsClient(); + return forLanguage(language, null); + } + + @ApiStatus.Internal + public static @NotNull List forLanguage(@NotNull Language language, @Nullable Editor editor) { + boolean isRDFrontend = NewRdCompletionSupport.isFrontendRdCompletionOn(editor) && PlatformUtils.isJetBrainsClient(); List contributors; if (isRDFrontend) { @@ -274,8 +283,8 @@ public abstract class CompletionContributor implements PossiblyDumbAware { } @ApiStatus.Internal - public static @NotNull List forLanguageHonorDumbness(@NotNull Language language, @NotNull Project project) { - List contributors = forLanguage(language); + public static @NotNull List forLanguageHonorDumbness(@NotNull Language language, @NotNull Project project, @NotNull Editor editor) { + List contributors = forLanguage(language, editor); return DumbService.getInstance(project).filterByDumbAwareness(contributors); } diff --git a/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionResultSet.java b/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionResultSet.java index 490ad2a59437..5c260f7c0ca4 100644 --- a/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionResultSet.java +++ b/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionResultSet.java @@ -1,4 +1,4 @@ -// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2026 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.completion.group.GroupedCompletionContributor; @@ -189,7 +189,7 @@ public abstract class CompletionResultSet implements Consumer { @NotNull Consumer consumer, boolean stop) { //grouped contributors are not allowed to be used in runRemainingContributors from other contributors - if (GroupedCompletionContributor.isGroupEnabledInApp() && + if (GroupedCompletionContributor.isGroupEnabled(parameters.getEditor()) && contributor instanceof GroupedCompletionContributor groupedCompletionContributor && groupedCompletionContributor.groupIsEnabled(parameters)) { return; diff --git a/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionService.java b/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionService.java index 5ee375a852f0..2c8aaa42f987 100644 --- a/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionService.java +++ b/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionService.java @@ -60,7 +60,7 @@ public abstract class CompletionService { @NotNull PrefixMatcher matcher, @NotNull Consumer consumer) { List contributors = CompletionContributor.forParameters(parameters); - boolean groupEnabledInApp = GroupedCompletionContributor.isGroupEnabledInApp(); + boolean groupEnabledInApp = GroupedCompletionContributor.isGroupEnabled(parameters.getEditor()); int startingIndex = from != null ? contributors.indexOf(from) + 1 : 0; for (int i = startingIndex; i < contributors.size(); i++) { @@ -97,7 +97,7 @@ public abstract class CompletionService { protected void getVariantsFromGroupContributors(@NotNull CompletionParameters parameters, @NotNull PrefixMatcher matcher, @NotNull Consumer consumer) { - if (!GroupedCompletionContributor.isGroupEnabledInApp()) { + if (!GroupedCompletionContributor.isGroupEnabled(parameters.getEditor())) { return; } final List contributors = CompletionContributor.forParameters(parameters); diff --git a/platform/analysis-api/src/com/intellij/codeInsight/completion/NewRdCompletionSupport.kt b/platform/analysis-api/src/com/intellij/codeInsight/completion/NewRdCompletionSupport.kt index 49de7c825cef..163403edf259 100644 --- a/platform/analysis-api/src/com/intellij/codeInsight/completion/NewRdCompletionSupport.kt +++ b/platform/analysis-api/src/com/intellij/codeInsight/completion/NewRdCompletionSupport.kt @@ -5,13 +5,14 @@ import com.intellij.codeInsight.lookup.Lookup import com.intellij.openapi.components.serviceOrNull import com.intellij.openapi.diagnostic.logger import com.intellij.openapi.editor.Editor +import com.intellij.openapi.extensions.ExtensionPointName import com.intellij.openapi.project.Project import com.intellij.openapi.util.registry.Registry import org.jetbrains.annotations.ApiStatus @ApiStatus.Internal interface NewRdCompletionSupport { - fun isFrontendRdCompletionOnImpl(): Boolean + fun isFrontendRdCompletionOnImpl(editor: Editor?): Boolean /** * Schedule autopopup for the given editor and completion type. @@ -45,7 +46,7 @@ interface NewRdCompletionSupport { * @return true if `remdev.completion.on.frontend` registry flag is enabled AND this is a host or a client of a remoteDev session. */ @JvmStatic - fun isFrontendRdCompletionOn(): Boolean = getInstance().isFrontendRdCompletionOnImpl() + fun isFrontendRdCompletionOn(editor: Editor?): Boolean = getInstance().isFrontendRdCompletionOnImpl(editor) /** * @return logs an error with a given [message] if `remdev.completion.on.frontend.report.suboptimal.usage` registry flag is enabled. @@ -68,7 +69,7 @@ interface NewRdCompletionSupport { } private object NoOpNewCompletionSupport : NewRdCompletionSupport { - override fun isFrontendRdCompletionOnImpl(): Boolean = false + override fun isFrontendRdCompletionOnImpl(editor: Editor?): Boolean = false override fun scheduleAutopopupOnFrontend(project: Project, editor: Editor, completionType: CompletionType) = false @@ -79,4 +80,14 @@ private object NoOpNewCompletionSupport : NewRdCompletionSupport { override fun noPsiAvailable(editor: Editor) {} override fun isBackendCompletionActionAvailableImpl(editor: Editor): Boolean = false -} \ No newline at end of file +} + +@ApiStatus.Internal +object NewRdCompletionVetoSupport { + private val ep_name: ExtensionPointName = ExtensionPointName("com.intellij.newRdCompletionVeto") + + fun isAllowed(editor: Editor?): Boolean = editor == null || !isVetoed(editor) + + private fun isVetoed(editor: Editor): Boolean = + ep_name.findFirstSafe { veto -> veto.veto(editor) } != null +} diff --git a/platform/analysis-api/src/com/intellij/codeInsight/completion/NewRdCompletionVeto.kt b/platform/analysis-api/src/com/intellij/codeInsight/completion/NewRdCompletionVeto.kt new file mode 100644 index 000000000000..fb5b86d02362 --- /dev/null +++ b/platform/analysis-api/src/com/intellij/codeInsight/completion/NewRdCompletionVeto.kt @@ -0,0 +1,23 @@ +// Copyright 2000-2026 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.codeInsight.completion + +import com.intellij.openapi.editor.Editor +import org.jetbrains.annotations.ApiStatus + +/** + * Allows forbidding new frontend-based completion support in RemoteDev + * + * ``` + * internal class MyLangNewRdVeto : NewRdCompletionVeto { + * override fun veto(editor: Editor): Boolean { + * val project = editor.project ?: return false + * val file = PsiUtilBase.getPsiFileInEditor(editor, project) ?: return false + * return file.language == MyLang.INSTANCE + * } + * } + * ``` + */ +@ApiStatus.Internal +interface NewRdCompletionVeto { + fun veto(editor: Editor): Boolean +} diff --git a/platform/analysis-api/src/com/intellij/codeInsight/completion/group/GroupedCompletion.kt b/platform/analysis-api/src/com/intellij/codeInsight/completion/group/GroupedCompletion.kt index 57f91b0de4c8..2a071dd12dfb 100644 --- a/platform/analysis-api/src/com/intellij/codeInsight/completion/group/GroupedCompletion.kt +++ b/platform/analysis-api/src/com/intellij/codeInsight/completion/group/GroupedCompletion.kt @@ -1,15 +1,16 @@ // Copyright 2000-2026 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.completion.group +import com.intellij.openapi.editor.Editor import org.jetbrains.annotations.ApiStatus @ApiStatus.Internal interface GroupedCompletion { /** - * Use [GroupedCompletionContributor.isGroupEnabledInApp] instead + * Use [GroupedCompletionContributor.isGroupEnabled] instead * * Determines whether the grouped code completion feature is enabled at the application level. * @return true if grouped code completion is enabled at the application level, otherwise false. */ - fun isEnabled(): Boolean + fun isEnabled(editor: Editor?): Boolean } diff --git a/platform/analysis-api/src/com/intellij/codeInsight/completion/group/GroupedCompletionContributor.java b/platform/analysis-api/src/com/intellij/codeInsight/completion/group/GroupedCompletionContributor.java index d39eb5e094a8..d4392cd03b1b 100644 --- a/platform/analysis-api/src/com/intellij/codeInsight/completion/group/GroupedCompletionContributor.java +++ b/platform/analysis-api/src/com/intellij/codeInsight/completion/group/GroupedCompletionContributor.java @@ -3,9 +3,11 @@ package com.intellij.codeInsight.completion.group; import com.intellij.codeInsight.completion.CompletionParameters; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.editor.Editor; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Represents a contributor for grouped code completion. Implementations of this interface are intended to define specific @@ -24,7 +26,7 @@ public interface GroupedCompletionContributor { * * @return true if grouped code completion is enabled at the application level, otherwise false. */ - static boolean isGroupEnabledInApp() { - return ApplicationManager.getApplication().getService(GroupedCompletion.class).isEnabled(); + static boolean isGroupEnabled(@Nullable Editor editor) { + return ApplicationManager.getApplication().getService(GroupedCompletion.class).isEnabled(editor); } } diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/completion/CompletionInitializationUtil.java b/platform/analysis-impl/src/com/intellij/codeInsight/completion/CompletionInitializationUtil.java index 001afdd1a5c1..019c63b472ce 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/completion/CompletionInitializationUtil.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/completion/CompletionInitializationUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2026 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.multiverse.CodeInsightContext; @@ -95,7 +95,7 @@ public final class CompletionInitializationUtil { DumbModeAccessType.RELIABLE_DATA_ONLY.ignoreDumbMode(() -> { Project project = psiFile.getProject(); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); - List contributors = CompletionContributor.forLanguageHonorDumbness(context.getPositionLanguage(), project); + List contributors = CompletionContributor.forLanguageHonorDumbness(context.getPositionLanguage(), project, editor); for (CompletionContributor contributor : contributors) { current.set(contributor); contributor.beforeCompletion(context); diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/completion/group/GroupedCompletionImpl.kt b/platform/analysis-impl/src/com/intellij/codeInsight/completion/group/GroupedCompletionImpl.kt index d35fe95e36bf..c82f224cbfae 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/completion/group/GroupedCompletionImpl.kt +++ b/platform/analysis-impl/src/com/intellij/codeInsight/completion/group/GroupedCompletionImpl.kt @@ -4,6 +4,7 @@ package com.intellij.codeInsight.completion.group import com.intellij.codeInsight.completion.NewRdCompletionSupport import com.intellij.idea.AppMode import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.editor.Editor import com.intellij.openapi.util.registry.Registry import com.intellij.util.PlatformUtils @@ -11,7 +12,7 @@ internal class GroupedCompletionImpl : GroupedCompletion { /** * @see com.intellij.codeInsight.completion.command.configuration.AppCommandCompletionSettings.calculateFromRegistry */ - override fun isEnabled(): Boolean { + override fun isEnabled(editor: Editor?): Boolean { if (!Registry.`is`("ide.completion.group.enabled", false)) { return false } @@ -31,7 +32,7 @@ internal class GroupedCompletionImpl : GroupedCompletion { return true } - if (NewRdCompletionSupport.isFrontendRdCompletionOn() && NewRdCompletionSupport.getInstance().isFrontendForIntelliJBackend()) { + if (NewRdCompletionSupport.isFrontendRdCompletionOn(editor) && NewRdCompletionSupport.getInstance().isFrontendForIntelliJBackend()) { return true } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.kt b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.kt index 2528b442ae0b..1dc4258ed407 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.kt @@ -384,7 +384,7 @@ sealed class CompletionPhase @ApiStatus.Internal constructor( @JvmStatic fun loadContributorsOutsideEdt(editor: Editor, file: PsiFile) { ThreadingAssertions.assertBackgroundThread() - CompletionContributor.forLanguage(PsiUtilCore.getLanguageAtOffset(file, editor.getCaretModel().offset)) + CompletionContributor.forLanguage(PsiUtilCore.getLanguageAtOffset(file, editor.getCaretModel().offset), editor) } @ApiStatus.Internal diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java index 0ee3dce2a070..d1389a316dae 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java @@ -203,8 +203,8 @@ public final class CompletionProgressIndicator extends ProgressIndicatorBase imp myAdvertiserChanges.offer(() -> this.lookup.getAdvertiser().clearAdvertisements()); - myArranger = GroupedCompletionContributor.isGroupEnabledInApp() ? new GroupCompletionLookupArrangerImpl(this) - : new CompletionLookupArrangerImpl(this); + myArranger = GroupedCompletionContributor.isGroupEnabled(myEditor) ? new GroupCompletionLookupArrangerImpl(this) + : new CompletionLookupArrangerImpl(this); this.lookup.setArranger(myArranger); this.lookup.addLookupListener(myLookupListener); @@ -287,7 +287,7 @@ public final class CompletionProgressIndicator extends ProgressIndicatorBase imp DumbModeAccessType.RELIABLE_DATA_ONLY.ignoreDumbMode(() -> { for (CompletionContributor contributor : - CompletionContributor.forLanguageHonorDumbness(initContext.getPositionLanguage(), initContext.getProject())) { + CompletionContributor.forLanguageHonorDumbness(initContext.getPositionLanguage(), initContext.getProject(), initContext.getEditor())) { ProgressManager.checkCanceled(); contributor.duringCompletion(initContext); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/actions/BaseCodeCompletionAction.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/actions/BaseCodeCompletionAction.java index 3560760ea282..97abde0ab60e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/actions/BaseCodeCompletionAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/actions/BaseCodeCompletionAction.java @@ -94,7 +94,7 @@ public abstract class BaseCodeCompletionAction extends DumbAwareAction implement } if (IdeProductMode.isFrontend()) { - return NewRdCompletionSupport.isFrontendRdCompletionOn(); + return NewRdCompletionSupport.isFrontendRdCompletionOn(editor); } if (IdeProductMode.isBackend()) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/command/CommandCompletionProvider.kt b/platform/lang-impl/src/com/intellij/codeInsight/completion/command/CommandCompletionProvider.kt index 60a94a85f141..b4da9e5cdbf2 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/command/CommandCompletionProvider.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/command/CommandCompletionProvider.kt @@ -265,7 +265,7 @@ internal class CommandCompletionProvider(val contributor: CommandCompletionContr private fun enableFastShown(parameters: CompletionParameters) { if (Registry.`is`("ide.completion.command.faster.paint")) { - if (!GroupedCompletionContributor.isGroupEnabledInApp()) return + if (!GroupedCompletionContributor.isGroupEnabled(parameters.editor)) return if (!contributor.groupIsEnabled(parameters)) return val completionProgressIndicator = parameters.process as? CompletionProgressIndicator val count = completionProgressIndicator?.lookup?.list?.model?.size ?: 0 diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/command/configuration/ApplicationCommandCompletionService.kt b/platform/lang-impl/src/com/intellij/codeInsight/completion/command/configuration/ApplicationCommandCompletionService.kt index afe0a71e3747..2c1b3d74bca0 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/command/configuration/ApplicationCommandCompletionService.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/command/configuration/ApplicationCommandCompletionService.kt @@ -130,7 +130,7 @@ internal class AppCommandCompletionSettings( // production if ( PlatformUtils.isIntelliJ() || - NewRdCompletionSupport.isFrontendRdCompletionOn() && NewRdCompletionSupport.getInstance().isFrontendForIntelliJBackend() + NewRdCompletionSupport.isFrontendRdCompletionOn(null) && NewRdCompletionSupport.getInstance().isFrontendForIntelliJBackend() ) { if (Registry.`is`("ide.completion.command.force.enabled")) { return true diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/command/configuration/CommandCompletionConfigurable.kt b/platform/lang-impl/src/com/intellij/codeInsight/completion/command/configuration/CommandCompletionConfigurable.kt index ee7639ec4130..f3b9fdb3f2cc 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/command/configuration/CommandCompletionConfigurable.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/command/configuration/CommandCompletionConfigurable.kt @@ -41,7 +41,7 @@ class CommandCompletionConfigurableProvider : ConfigurableProvider() { { r -> settings.state.setEnabled(r) }) .contextHelp(CodeInsightBundle.message("options.command.completion.display.comment")) } - if (GroupedCompletionContributor.isGroupEnabledInApp()) { + if (GroupedCompletionContributor.isGroupEnabled(null)) { indent { row { checkBox(CodeInsightBundle.message("options.command.completion.show.group")) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedAutoPopupImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedAutoPopupImpl.java index b7a67928f372..17f6b18e13f2 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedAutoPopupImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedAutoPopupImpl.java @@ -73,7 +73,7 @@ final class TypedAutoPopupImpl { } language = element.getLanguage(); } - List contributors = CompletionContributor.forLanguageHonorDumbness(language, file.getProject()); + List contributors = CompletionContributor.forLanguageHonorDumbness(language, file.getProject(), editor); if (contributors.isEmpty()) { return false; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesConfigurableUi.kt b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesConfigurableUi.kt index 3d564fcbb66a..baa886bd089a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesConfigurableUi.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesConfigurableUi.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2026 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.template.postfix.settings import com.intellij.codeInsight.CodeInsightBundle @@ -63,7 +63,7 @@ internal class PostfixTemplatesConfigurableUi : Disposable { postfixTemplatesGroupCompletion = checkBox(CodeInsightBundle.message("postfix.completion.option.group.enabled")) .component } - }.visible(GroupedCompletionContributor.isGroupEnabledInApp()) + }.visible(GroupedCompletionContributor.isGroupEnabled(null)) row { completionEnabledCheckbox = checkBox(CodeInsightBundle.message("postfix.completion.option.autopopup")) .component diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesSettings.java b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesSettings.java index 5b3a4ce26714..92ca5b09d9d8 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesSettings.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesSettings.java @@ -72,7 +72,7 @@ public final class PostfixTemplatesSettings implements PersistentStateComponent< } public boolean isShowAsSeparateGroup() { - return showAsSeparateGroup && GroupedCompletionContributor.isGroupEnabledInApp(); + return showAsSeparateGroup && GroupedCompletionContributor.isGroupEnabled(null); } public void setShowAsSeparateGroup(boolean showAsSeparateGroup) {