mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
IJPL-166447: vcs marker: Close popup when call the completion
(cherry picked from commit 4e1b49b0a9e6304f33fcb29610f86535e2006ca1) IJ-CR-149651 GitOrigin-RevId: d478b1ef381380156b2ab03aaa0d392dd0492b54
This commit is contained in:
committed by
intellij-monorepo-bot
parent
008dc74c2c
commit
814318fa18
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user