@codingame/monaco-vscode-quickaccess-service-override 1.83.8 → 1.83.10-next.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.
@@ -0,0 +1,265 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
3
+ import { IQuickInputService, ItemActivation } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
4
+ import { PickerQuickAccessProvider } from 'vscode/vscode/vs/platform/quickinput/browser/pickerQuickAccess';
5
+ import { IViewDescriptorService, IViewsService } from 'vscode/vscode/vs/workbench/common/views';
6
+ import { IOutputService } from 'vscode/vscode/vs/workbench/services/output/common/output';
7
+ import { ITerminalService, ITerminalGroupService } from 'vscode/vscode/vs/workbench/contrib/terminal/browser/terminal';
8
+ import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
9
+ import { matchesFuzzy } from 'monaco-editor/esm/vs/base/common/filters.js';
10
+ import { fuzzyContains } from 'monaco-editor/esm/vs/base/common/strings.js';
11
+ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
12
+ import { Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
13
+ import { Categories } from 'monaco-editor/esm/vs/platform/action/common/actionCommonCategories.js';
14
+ import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/panecomposite/browser/panecomposite';
15
+ import { REPL_VIEW_ID, IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
16
+
17
+ var ViewQuickAccessProvider_1;
18
+ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickAccessProvider {
19
+ static { ViewQuickAccessProvider_1 = this; }
20
+ static { this.PREFIX = 'view '; }
21
+ constructor(viewDescriptorService, viewsService, outputService, terminalService, terminalGroupService, debugService, paneCompositeService, contextKeyService) {
22
+ super(ViewQuickAccessProvider_1.PREFIX, {
23
+ noResultsPick: {
24
+ label: ( localizeWithPath(
25
+ 'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
26
+ 'noViewResults',
27
+ "No matching views"
28
+ )),
29
+ containerLabel: ''
30
+ }
31
+ });
32
+ this.viewDescriptorService = viewDescriptorService;
33
+ this.viewsService = viewsService;
34
+ this.outputService = outputService;
35
+ this.terminalService = terminalService;
36
+ this.terminalGroupService = terminalGroupService;
37
+ this.debugService = debugService;
38
+ this.paneCompositeService = paneCompositeService;
39
+ this.contextKeyService = contextKeyService;
40
+ }
41
+ _getPicks(filter) {
42
+ const filteredViewEntries = this.doGetViewPickItems().filter(entry => {
43
+ if (!filter) {
44
+ return true;
45
+ }
46
+ entry.highlights = { label: matchesFuzzy(filter, entry.label, true) ?? undefined };
47
+ return entry.highlights.label || fuzzyContains(entry.containerLabel, filter);
48
+ });
49
+ const mapEntryToContainer = ( new Map());
50
+ for (const entry of filteredViewEntries) {
51
+ if (!( mapEntryToContainer.has(entry.label))) {
52
+ mapEntryToContainer.set(entry.label, entry.containerLabel);
53
+ }
54
+ }
55
+ const filteredViewEntriesWithSeparators = [];
56
+ let lastContainer = undefined;
57
+ for (const entry of filteredViewEntries) {
58
+ if (lastContainer !== entry.containerLabel) {
59
+ lastContainer = entry.containerLabel;
60
+ let separatorLabel;
61
+ if (( mapEntryToContainer.has(lastContainer))) {
62
+ separatorLabel = `${mapEntryToContainer.get(lastContainer)} / ${lastContainer}`;
63
+ }
64
+ else {
65
+ separatorLabel = lastContainer;
66
+ }
67
+ filteredViewEntriesWithSeparators.push({ type: 'separator', label: separatorLabel });
68
+ }
69
+ filteredViewEntriesWithSeparators.push(entry);
70
+ }
71
+ return filteredViewEntriesWithSeparators;
72
+ }
73
+ doGetViewPickItems() {
74
+ const viewEntries = [];
75
+ const getViewEntriesForPaneComposite = (paneComposite, viewContainer) => {
76
+ const viewContainerModel = this.viewDescriptorService.getViewContainerModel(viewContainer);
77
+ const result = [];
78
+ for (const view of viewContainerModel.allViewDescriptors) {
79
+ if (this.contextKeyService.contextMatchesRules(view.when)) {
80
+ result.push({
81
+ label: view.name,
82
+ containerLabel: viewContainerModel.title,
83
+ accept: () => this.viewsService.openView(view.id, true)
84
+ });
85
+ }
86
+ }
87
+ return result;
88
+ };
89
+ const addPaneComposites = (location, containerLabel) => {
90
+ const paneComposites = this.paneCompositeService.getPaneComposites(location);
91
+ const visiblePaneCompositeIds = this.paneCompositeService.getVisiblePaneCompositeIds(location);
92
+ paneComposites.sort((a, b) => {
93
+ let aIndex = visiblePaneCompositeIds.findIndex(id => a.id === id);
94
+ let bIndex = visiblePaneCompositeIds.findIndex(id => b.id === id);
95
+ if (aIndex < 0) {
96
+ aIndex = paneComposites.indexOf(a) + visiblePaneCompositeIds.length;
97
+ }
98
+ if (bIndex < 0) {
99
+ bIndex = paneComposites.indexOf(b) + visiblePaneCompositeIds.length;
100
+ }
101
+ return aIndex - bIndex;
102
+ });
103
+ for (const paneComposite of paneComposites) {
104
+ if (this.includeViewContainer(paneComposite)) {
105
+ const viewContainer = this.viewDescriptorService.getViewContainerById(paneComposite.id);
106
+ if (viewContainer) {
107
+ viewEntries.push({
108
+ label: this.viewDescriptorService.getViewContainerModel(viewContainer).title,
109
+ containerLabel,
110
+ accept: () => this.paneCompositeService.openPaneComposite(paneComposite.id, location, true)
111
+ });
112
+ }
113
+ }
114
+ }
115
+ };
116
+ addPaneComposites(0 , ( localizeWithPath(
117
+ 'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
118
+ 'views',
119
+ "Side Bar"
120
+ )));
121
+ addPaneComposites(1 , ( localizeWithPath(
122
+ 'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
123
+ 'panels',
124
+ "Panel"
125
+ )));
126
+ addPaneComposites(2 , ( localizeWithPath(
127
+ 'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
128
+ 'secondary side bar',
129
+ "Secondary Side Bar"
130
+ )));
131
+ const addPaneCompositeViews = (location) => {
132
+ const paneComposites = this.paneCompositeService.getPaneComposites(location);
133
+ for (const paneComposite of paneComposites) {
134
+ const viewContainer = this.viewDescriptorService.getViewContainerById(paneComposite.id);
135
+ if (viewContainer) {
136
+ viewEntries.push(...getViewEntriesForPaneComposite(paneComposite, viewContainer));
137
+ }
138
+ }
139
+ };
140
+ addPaneCompositeViews(0 );
141
+ addPaneCompositeViews(1 );
142
+ addPaneCompositeViews(2 );
143
+ this.terminalGroupService.groups.forEach((group, groupIndex) => {
144
+ group.terminalInstances.forEach((terminal, terminalIndex) => {
145
+ const label = ( localizeWithPath(
146
+ 'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
147
+ 'terminalTitle',
148
+ "{0}: {1}",
149
+ `${groupIndex + 1}.${terminalIndex + 1}`,
150
+ terminal.title
151
+ ));
152
+ viewEntries.push({
153
+ label,
154
+ containerLabel: ( localizeWithPath(
155
+ 'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
156
+ 'terminals',
157
+ "Terminal"
158
+ )),
159
+ accept: async () => {
160
+ await this.terminalGroupService.showPanel(true);
161
+ this.terminalService.setActiveInstance(terminal);
162
+ }
163
+ });
164
+ });
165
+ });
166
+ this.debugService.getModel().getSessions(true).filter(s => s.hasSeparateRepl()).forEach((session, _) => {
167
+ const label = session.name;
168
+ viewEntries.push({
169
+ label,
170
+ containerLabel: ( localizeWithPath(
171
+ 'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
172
+ 'debugConsoles',
173
+ "Debug Console"
174
+ )),
175
+ accept: async () => {
176
+ await this.debugService.focusStackFrame(undefined, undefined, session, { explicit: true });
177
+ if (!this.viewsService.isViewVisible(REPL_VIEW_ID)) {
178
+ await this.viewsService.openView(REPL_VIEW_ID, true);
179
+ }
180
+ }
181
+ });
182
+ });
183
+ const channels = this.outputService.getChannelDescriptors();
184
+ for (const channel of channels) {
185
+ viewEntries.push({
186
+ label: channel.label,
187
+ containerLabel: ( localizeWithPath(
188
+ 'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
189
+ 'channels',
190
+ "Output"
191
+ )),
192
+ accept: () => this.outputService.showChannel(channel.id)
193
+ });
194
+ }
195
+ return viewEntries;
196
+ }
197
+ includeViewContainer(container) {
198
+ const viewContainer = this.viewDescriptorService.getViewContainerById(container.id);
199
+ if (viewContainer?.hideIfEmpty) {
200
+ return this.viewDescriptorService.getViewContainerModel(viewContainer).activeViewDescriptors.length > 0;
201
+ }
202
+ return true;
203
+ }
204
+ };
205
+ ViewQuickAccessProvider = ViewQuickAccessProvider_1 = ( __decorate([
206
+ ( __param(0, IViewDescriptorService)),
207
+ ( __param(1, IViewsService)),
208
+ ( __param(2, IOutputService)),
209
+ ( __param(3, ITerminalService)),
210
+ ( __param(4, ITerminalGroupService)),
211
+ ( __param(5, IDebugService)),
212
+ ( __param(6, IPaneCompositePartService)),
213
+ ( __param(7, IContextKeyService))
214
+ ], ViewQuickAccessProvider));
215
+ class OpenViewPickerAction extends Action2 {
216
+ static { this.ID = 'workbench.action.openView'; }
217
+ constructor() {
218
+ super({
219
+ id: OpenViewPickerAction.ID,
220
+ title: { value: ( localizeWithPath(
221
+ 'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
222
+ 'openView',
223
+ "Open View"
224
+ )), original: 'Open View' },
225
+ category: Categories.View,
226
+ f1: true
227
+ });
228
+ }
229
+ async run(accessor) {
230
+ accessor.get(IQuickInputService).quickAccess.show(ViewQuickAccessProvider.PREFIX);
231
+ }
232
+ }
233
+ class QuickAccessViewPickerAction extends Action2 {
234
+ static { this.ID = 'workbench.action.quickOpenView'; }
235
+ static { this.KEYBINDING = {
236
+ primary: 2048 | 47 ,
237
+ mac: { primary: 256 | 47 },
238
+ linux: { primary: 0 }
239
+ }; }
240
+ constructor() {
241
+ super({
242
+ id: QuickAccessViewPickerAction.ID,
243
+ title: { value: ( localizeWithPath(
244
+ 'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
245
+ 'quickOpenView',
246
+ "Quick Open View"
247
+ )), original: 'Quick Open View' },
248
+ category: Categories.View,
249
+ f1: false,
250
+ keybinding: {
251
+ weight: 200 ,
252
+ when: undefined,
253
+ ...QuickAccessViewPickerAction.KEYBINDING
254
+ }
255
+ });
256
+ }
257
+ async run(accessor) {
258
+ const keybindingService = accessor.get(IKeybindingService);
259
+ const quickInputService = accessor.get(IQuickInputService);
260
+ const keys = keybindingService.lookupKeybindings(QuickAccessViewPickerAction.ID);
261
+ quickInputService.quickAccess.show(ViewQuickAccessProvider.PREFIX, { quickNavigateConfiguration: { keybindings: keys }, itemActivation: ItemActivation.FIRST });
262
+ }
263
+ }
264
+
265
+ export { OpenViewPickerAction, QuickAccessViewPickerAction, ViewQuickAccessProvider };
@@ -0,0 +1,69 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { ILayoutService } from 'monaco-editor/esm/vs/platform/layout/browser/layoutService.js';
3
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
4
+ import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
5
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
6
+ import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
7
+ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
8
+ import { QuickInputService as QuickInputService$1 } from 'monaco-editor/esm/vs/platform/quickinput/browser/quickInputService.js';
9
+ import { InQuickPickContextKey } from 'vscode/vscode/vs/workbench/browser/quickaccess';
10
+ import { IHoverService } from 'vscode/vscode/vs/workbench/services/hover/browser/hover';
11
+
12
+ let QuickInputService = class QuickInputService extends QuickInputService$1 {
13
+ constructor(configurationService, instantiationService, keybindingService, contextKeyService, themeService, layoutService, hoverService) {
14
+ super(instantiationService, contextKeyService, themeService, layoutService);
15
+ this.configurationService = configurationService;
16
+ this.keybindingService = keybindingService;
17
+ this.hoverService = hoverService;
18
+ this.hoverDelegate = ( new QuickInputHoverDelegate(this.configurationService, this.hoverService));
19
+ this.inQuickInputContext = InQuickPickContextKey.bindTo(this.contextKeyService);
20
+ this.registerListeners();
21
+ }
22
+ registerListeners() {
23
+ this._register(this.onShow(() => this.inQuickInputContext.set(true)));
24
+ this._register(this.onHide(() => this.inQuickInputContext.set(false)));
25
+ }
26
+ createController() {
27
+ return super.createController(this.layoutService, {
28
+ ignoreFocusOut: () => !this.configurationService.getValue('workbench.quickOpen.closeOnFocusLost'),
29
+ backKeybindingLabel: () => this.keybindingService.lookupKeybinding('workbench.action.quickInputBack')?.getLabel() || undefined,
30
+ hoverDelegate: this.hoverDelegate
31
+ });
32
+ }
33
+ };
34
+ QuickInputService = ( __decorate([
35
+ ( __param(0, IConfigurationService)),
36
+ ( __param(1, IInstantiationService)),
37
+ ( __param(2, IKeybindingService)),
38
+ ( __param(3, IContextKeyService)),
39
+ ( __param(4, IThemeService)),
40
+ ( __param(5, ILayoutService)),
41
+ ( __param(6, IHoverService))
42
+ ], QuickInputService));
43
+ class QuickInputHoverDelegate {
44
+ get delay() {
45
+ if (Date.now() - this.lastHoverHideTime < 200) {
46
+ return 0;
47
+ }
48
+ return this.configurationService.getValue('workbench.hover.delay');
49
+ }
50
+ constructor(configurationService, hoverService) {
51
+ this.configurationService = configurationService;
52
+ this.hoverService = hoverService;
53
+ this.lastHoverHideTime = 0;
54
+ this.placement = 'element';
55
+ }
56
+ showHover(options, focus) {
57
+ return this.hoverService.showHover({
58
+ ...options,
59
+ showHoverHint: true,
60
+ hideOnKeyDown: false,
61
+ skipFadeInAnimation: true,
62
+ }, focus);
63
+ }
64
+ onDidHideHover() {
65
+ this.lastHoverHideTime = Date.now();
66
+ }
67
+ }
68
+
69
+ export { QuickInputService };