Skip to content

Commit 66ab658

Browse files
committed
Add back hideHover and use on tree context menu show
Fixes microsoft#106268
1 parent 2edbe68 commit 66ab658

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/vs/workbench/contrib/views/browser/treeView.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export class TreeView extends Disposable implements ITreeView {
113113
@IKeybindingService private readonly keybindingService: IKeybindingService,
114114
@INotificationService private readonly notificationService: INotificationService,
115115
@IViewDescriptorService private readonly viewDescriptorService: IViewDescriptorService,
116+
@IHoverService private readonly hoverService: IHoverService,
116117
@IContextKeyService contextKeyService: IContextKeyService
117118
) {
118119
super();
@@ -434,6 +435,7 @@ export class TreeView extends Disposable implements ITreeView {
434435
}
435436

436437
private onContextMenu(treeMenus: TreeMenus, treeEvent: ITreeContextMenuEvent<ITreeItem>, actionRunner: MultipleSelectionActionRunner): void {
438+
this.hoverService.hideHover();
437439
const node: ITreeItem | null = treeEvent.element;
438440
if (node === null) {
439441
return;
@@ -1026,7 +1028,7 @@ export class CustomTreeView extends TreeView {
10261028
@IHoverService hoverService: IHoverService,
10271029
@IExtensionService private readonly extensionService: IExtensionService,
10281030
) {
1029-
super(id, title, themeService, instantiationService, commandService, configurationService, progressService, contextMenuService, keybindingService, notificationService, viewDescriptorService, contextKeyService);
1031+
super(id, title, themeService, instantiationService, commandService, configurationService, progressService, contextMenuService, keybindingService, notificationService, viewDescriptorService, hoverService, contextKeyService);
10301032
}
10311033

10321034
setVisibility(isVisible: boolean): void {

src/vs/workbench/services/hover/browser/hover.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ export interface IHoverService {
3030
* ```
3131
*/
3232
showHover(options: IHoverOptions, focus?: boolean): IDisposable | undefined;
33+
34+
/**
35+
* Hides the hover if it was visible.
36+
*/
37+
hideHover(): void;
3338
}
3439

3540
export interface IHoverOptions {

src/vs/workbench/services/hover/browser/hoverService.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ export class HoverService implements IHoverService {
4747
return hover;
4848
}
4949

50+
hideHover(): void {
51+
if (!this._currentHoverOptions) {
52+
return;
53+
}
54+
this._currentHoverOptions = undefined;
55+
this._contextViewService.hideContextView();
56+
}
57+
5058
private _intersectionChange(entries: IntersectionObserverEntry[], hover: IDisposable): void {
5159
const entry = entries[entries.length - 1];
5260
if (!entry.isIntersecting) {

0 commit comments

Comments
 (0)