From 814318fa18a2b244b5256aa56969792b2d55760e Mon Sep 17 00:00:00 2001 From: Aleksandr Krasilnikov Date: Thu, 7 Nov 2024 19:30:50 +0100 Subject: [PATCH] IJPL-166447: vcs marker: Close popup when call the completion (cherry picked from commit 4e1b49b0a9e6304f33fcb29610f86535e2006ca1) IJ-CR-149651 GitOrigin-RevId: d478b1ef381380156b2ab03aaa0d392dd0492b54 --- .../vcs/ex/LineStatusMarkerPopupService.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusMarkerPopupService.kt b/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusMarkerPopupService.kt index cc6ce8cf8ebc..4cbfac618f22 100644 --- a/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusMarkerPopupService.kt +++ b/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusMarkerPopupService.kt @@ -1,8 +1,11 @@ // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.vcs.ex +import com.intellij.codeInsight.hint.EditorHintListener import com.intellij.codeInsight.hint.HintManager import com.intellij.codeInsight.hint.HintManagerImpl +import com.intellij.codeInsight.lookup.Lookup +import com.intellij.codeInsight.lookup.LookupManager import com.intellij.openapi.Disposable import com.intellij.openapi.actionSystem.DataContext import com.intellij.openapi.application.ApplicationManager @@ -125,6 +128,7 @@ internal class LineStatusMarkerPopupService { trackCaretPosition(editor, popupDisposable, hint) trackScrolling(editor, popupDisposable, hint) trackMouseClick(editor, popupDisposable, hint) + trackEditorLookup(editor, popupDisposable, hint) } private fun trackFileEditorChange(popupDisposable: Disposable, hint: LightweightHint) { @@ -188,6 +192,21 @@ internal class LineStatusMarkerPopupService { }, popupDisposable) } + private fun trackEditorLookup(editor: Editor, popupDisposable: Disposable, hint: LightweightHint) { + val project = editor.project + if (project != null) LookupManager.hideActiveLookup(project) // reset current + + ApplicationManager.getApplication().getMessageBus().connect(popupDisposable) + .subscribe(EditorHintListener.TOPIC, object : EditorHintListener { + override fun hintShown(sourceEditor: Editor, editorHint: LightweightHint, flags: Int, hintInfo: HintHint) { + if (sourceEditor !== editor) return + if (editorHint is Lookup) { + hint.hide() + } + } + }) + } + @JvmStatic val instance: LineStatusMarkerPopupService get() = ApplicationManager.getApplication()