From d8323df36fb8e2489510653967675d415bf62bbb Mon Sep 17 00:00:00 2001 From: Aleksandr Krasilnikov Date: Sat, 19 Oct 2024 16:51:12 +0200 Subject: [PATCH] IJPL-164292 vsc marker: Add separate EditorActionHandler to close Marker Popup simultaneously with the intention bulb IJ-MR-147690 GitOrigin-RevId: 8a5f2de379efc13a98f2403efea3d19613bb1854 --- .../diff-impl/resources/META-INF/diff-impl.xml | 5 +++++ .../vcs/ex/LineStatusMarkerPopupService.kt | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/platform/diff-impl/resources/META-INF/diff-impl.xml b/platform/diff-impl/resources/META-INF/diff-impl.xml index 9e65bbd6ddaa..dd13c877207d 100644 --- a/platform/diff-impl/resources/META-INF/diff-impl.xml +++ b/platform/diff-impl/resources/META-INF/diff-impl.xml @@ -4,6 +4,11 @@ + + 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 1ba6cc6abb8a..c4c209db01cb 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 @@ -4,11 +4,14 @@ package com.intellij.openapi.vcs.ex import com.intellij.codeInsight.hint.HintManager import com.intellij.codeInsight.hint.HintManagerImpl import com.intellij.openapi.Disposable +import com.intellij.openapi.actionSystem.DataContext import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.Service +import com.intellij.openapi.editor.Caret import com.intellij.openapi.editor.Document import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.LogicalPosition +import com.intellij.openapi.editor.actionSystem.EditorActionHandler import com.intellij.openapi.editor.event.* import com.intellij.openapi.fileEditor.FileEditorManagerEvent import com.intellij.openapi.fileEditor.FileEditorManagerListener @@ -63,6 +66,10 @@ internal class LineStatusMarkerPopupService { } } + internal fun hidePopup() { + lastKnownHint?.hide() + } + private fun beforeShowNewHint(newHint: LightweightHint) { if (lastKnownHint != null) { lastKnownHint!!.hide() @@ -179,3 +186,14 @@ internal class LineStatusMarkerPopupService { .getService(LineStatusMarkerPopupService::class.java) } } + +private class LineStatusMakerEscEditorHandler(private val delegate: EditorActionHandler) : EditorActionHandler() { + override fun isEnabledForCaret(editor: Editor, caret: Caret, dataContext: DataContext?): Boolean { + return delegate.isEnabled(editor, caret, dataContext) + } + + override fun doExecute(editor: Editor, caret: Caret?, dataContext: DataContext?) { + LineStatusMarkerPopupService.instance.hidePopup() + delegate.execute(editor, caret, dataContext) + } +} \ No newline at end of file