@codingame/monaco-vscode-view-status-bar-service-override 37.6.0 → 38.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-view-status-bar-service-override",
3
- "version": "37.6.0",
3
+ "version": "38.0.0",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - view-status-bar service-override",
6
6
  "keywords": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "37.6.0"
18
+ "@codingame/monaco-vscode-api": "38.0.0"
19
19
  },
20
20
  "main": "index.js",
21
21
  "module": "index.js",
@@ -30,7 +30,7 @@ class ToggleStatusbarEntryVisibilityAction extends Action {
30
30
  }
31
31
  class HideStatusbarEntryAction extends Action {
32
32
  constructor(id, name, model) {
33
- super(id, ( localize(6305, "Hide '{0}'", name)), undefined, true);
33
+ super(id, ( localize(7664, "Hide '{0}'", name)), undefined, true);
34
34
  this.model = model;
35
35
  }
36
36
  async run() {
@@ -39,7 +39,7 @@ class HideStatusbarEntryAction extends Action {
39
39
  }
40
40
  let ManageExtensionAction = class ManageExtensionAction extends Action {
41
41
  constructor(extensionId, commandService) {
42
- super("statusbar.manage.extension", ( localize(6306, "Manage Extension")));
42
+ super("statusbar.manage.extension", ( localize(7665, "Manage Extension")));
43
43
  this.extensionId = extensionId;
44
44
  this.commandService = commandService;
45
45
  }
@@ -111,7 +111,7 @@ class FocusStatusBarAction extends Action2 {
111
111
  constructor() {
112
112
  super({
113
113
  id: "workbench.action.focusStatusBar",
114
- title: ( localize2(6307, "Focus Status Bar")),
114
+ title: ( localize2(7666, "Focus Status Bar")),
115
115
  category: Categories.View,
116
116
  f1: true
117
117
  });
@@ -19,6 +19,7 @@ export declare class StatusbarEntryItem extends Disposable {
19
19
  private readonly foregroundListener;
20
20
  private readonly backgroundListener;
21
21
  private readonly commandMouseListener;
22
+ private readonly commandPointerListener;
22
23
  private readonly commandTouchListener;
23
24
  private readonly commandKeyboardListener;
24
25
  private hover;
@@ -5,10 +5,10 @@ import { Disposable, MutableDisposable } from '@codingame/monaco-vscode-api/vsco
5
5
  import { SimpleIconLabel } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/iconLabel/simpleIconLabel';
6
6
  import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
7
7
  import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
8
- import { isTooltipWithCommands, ShowTooltipCommand, StatusbarEntryKinds } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar';
8
+ import { isTooltipWithCommands, ShowTooltipCommand, ToggleTooltipCommand, StatusbarEntryKinds } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar';
9
9
  import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
10
10
  import { isThemeColor } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/editorCommon';
11
- import { $, show, hide, addDisposableListener, EventType, EventHelper, append } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
11
+ import { $, show, hide, addDisposableListener, EventType, isPointerEvent, EventHelper, append } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
12
12
  import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
13
13
  import { assertReturnsDefined } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
14
14
  import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
@@ -48,6 +48,7 @@ let StatusbarEntryItem = class StatusbarEntryItem extends Disposable {
48
48
  this.foregroundListener = this._register(( new MutableDisposable()));
49
49
  this.backgroundListener = this._register(( new MutableDisposable()));
50
50
  this.commandMouseListener = this._register(( new MutableDisposable()));
51
+ this.commandPointerListener = this._register(( new MutableDisposable()));
51
52
  this.commandTouchListener = this._register(( new MutableDisposable()));
52
53
  this.commandKeyboardListener = this._register(( new MutableDisposable()));
53
54
  this.hover = undefined;
@@ -88,6 +89,7 @@ let StatusbarEntryItem = class StatusbarEntryItem extends Disposable {
88
89
  if (isTooltipWithCommands(entry.tooltip)) {
89
90
  hoverTooltip = entry.tooltip.content;
90
91
  hoverOptions = {
92
+ onDidShow: entry.tooltip.onDidShow,
91
93
  actions: entry.tooltip.commands.map(command => ({
92
94
  commandId: command.id,
93
95
  label: command.title,
@@ -111,16 +113,28 @@ let StatusbarEntryItem = class StatusbarEntryItem extends Disposable {
111
113
  }
112
114
  if (!this.entry || entry.command !== this.entry.command) {
113
115
  this.commandMouseListener.clear();
116
+ this.commandPointerListener.clear();
114
117
  this.commandTouchListener.clear();
115
118
  this.commandKeyboardListener.clear();
116
119
  const command = entry.command;
117
- if (command && (command !== ShowTooltipCommand || this.hover) ) {
118
- this.commandMouseListener.value = addDisposableListener(this.labelContainer, EventType.CLICK, () => this.executeCommand(command));
119
- this.commandTouchListener.value = addDisposableListener(
120
- this.labelContainer,
121
- EventType$1.Tap,
122
- () => this.executeCommand(command)
123
- );
120
+ const isTooltipCommand = command === ShowTooltipCommand || command === ToggleTooltipCommand;
121
+ if (command && (!isTooltipCommand || this.hover)) {
122
+ let tooltipPointerDown;
123
+ if (command === ToggleTooltipCommand) {
124
+ this.commandPointerListener.value = addDisposableListener(this.labelContainer, EventType.POINTER_DOWN, e => {
125
+ tooltipPointerDown = e.button === 0 ? {
126
+ pointerId: e.pointerId,
127
+ wasPinned: !!this.hoverService.getStickyHover(this.container)
128
+ } : undefined;
129
+ });
130
+ }
131
+ const executeCommand = event => {
132
+ const wasPinned = tooltipPointerDown && isPointerEvent(event) && event.detail > 0 && event.pointerId === tooltipPointerDown.pointerId ? tooltipPointerDown.wasPinned : undefined;
133
+ tooltipPointerDown = undefined;
134
+ this.executeCommand(command, wasPinned);
135
+ };
136
+ this.commandMouseListener.value = addDisposableListener(this.labelContainer, EventType.CLICK, executeCommand);
137
+ this.commandTouchListener.value = addDisposableListener(this.labelContainer, EventType$1.Tap, executeCommand);
124
138
  this.commandKeyboardListener.value = addDisposableListener(this.labelContainer, EventType.KEY_DOWN, e => {
125
139
  const event = ( new StandardKeyboardEvent(e));
126
140
  if (event.equals(KeyCode.Space) || event.equals(KeyCode.Enter)) {
@@ -180,9 +194,15 @@ let StatusbarEntryItem = class StatusbarEntryItem extends Disposable {
180
194
  }
181
195
  return tooltip === otherTooltip;
182
196
  }
183
- async executeCommand(command) {
184
- if (command === ShowTooltipCommand) {
185
- this.hover?.show(true );
197
+ async executeCommand(command, tooltipWasPinnedOnPointerDown) {
198
+ if (command === ShowTooltipCommand || command === ToggleTooltipCommand) {
199
+ const stickyHover = command === ToggleTooltipCommand ? this.hoverService.getStickyHover(this.container) : undefined;
200
+ if (command === ToggleTooltipCommand && (tooltipWasPinnedOnPointerDown ?? !!stickyHover)) {
201
+ this.hover?.hide();
202
+ stickyHover?.dispose();
203
+ } else {
204
+ this.hover?.show(true );
205
+ }
186
206
  }
187
207
  else {
188
208
  const id = typeof command === "string" ? command : command.id;
@@ -512,7 +512,7 @@ let StatusbarPart = class StatusbarPart extends Part {
512
512
  const actions = [];
513
513
  actions.push(toAction({
514
514
  id: ToggleStatusbarVisibilityAction.ID,
515
- label: ( localize(6308, "Hide Status Bar")),
515
+ label: ( localize(7667, "Hide Status Bar")),
516
516
  run: () => this.instantiationService.invokeFunction(accessor => ( new ToggleStatusbarVisibilityAction()).run(accessor))
517
517
  }));
518
518
  actions.push(( new Separator()));