@codingame/monaco-vscode-user-data-sync-service-override 4.5.2 → 5.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 +2 -2
- package/vscode/src/vs/platform/userDataSync/common/settingsSync.js +1 -1
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestSync.js +10 -16
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncConflictsView.js +10 -6
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.js +2 -1
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +8 -4
- package/vscode/src/vs/base/browser/ui/icons/iconSelectBox.css.js +0 -6
- package/vscode/src/vs/base/browser/ui/icons/iconSelectBox.js +0 -241
- package/vscode/src/vs/workbench/services/userDataProfile/browser/iconSelectBox.js +0 -99
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-user-data-sync-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@5.0.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -42,7 +42,7 @@ let SettingsSynchroniser = class SettingsSynchroniser extends AbstractJsonFileSy
|
|
|
42
42
|
const lastSyncUserData = await this.getLastSyncUserData();
|
|
43
43
|
const remoteUserData = await this.getLatestRemoteUserData(manifest, lastSyncUserData);
|
|
44
44
|
const remoteSettingsSyncContent = this.getSettingsSyncContent(remoteUserData);
|
|
45
|
-
const parser = ( new ConfigurationModelParser(USER_DATA_SYNC_CONFIGURATION_SCOPE));
|
|
45
|
+
const parser = ( new ConfigurationModelParser(USER_DATA_SYNC_CONFIGURATION_SCOPE, this.logService));
|
|
46
46
|
if (remoteSettingsSyncContent?.settings) {
|
|
47
47
|
parser.parse(remoteSettingsSyncContent.settings);
|
|
48
48
|
}
|
|
@@ -150,28 +150,22 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
150
150
|
await this.userDataProfilesService.removeProfile(profile);
|
|
151
151
|
this.logService.info(`${this.syncResourceLogLabel}: Removed profile '${profile.name}'.`);
|
|
152
152
|
})));
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
})());
|
|
160
|
-
}
|
|
161
|
-
for (const profile of local.updated) {
|
|
153
|
+
await Promise.all(( local.added.map(async (profile) => {
|
|
154
|
+
this.logService.trace(`${this.syncResourceLogLabel}: Creating '${profile.name}' profile...`);
|
|
155
|
+
await this.userDataProfilesService.createProfile(profile.id, profile.name, { shortName: profile.shortName, icon: profile.icon, useDefaultFlags: profile.useDefaultFlags });
|
|
156
|
+
this.logService.info(`${this.syncResourceLogLabel}: Created profile '${profile.name}'.`);
|
|
157
|
+
})));
|
|
158
|
+
await Promise.all(( local.updated.map(async (profile) => {
|
|
162
159
|
const localProfile = this.userDataProfilesService.profiles.find(p => p.id === profile.id);
|
|
163
160
|
if (localProfile) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
this.logService.info(`${this.syncResourceLogLabel}: Updated profile '${profile.name}'.`);
|
|
168
|
-
})());
|
|
161
|
+
this.logService.trace(`${this.syncResourceLogLabel}: Updating '${profile.name}' profile...`);
|
|
162
|
+
await this.userDataProfilesService.updateProfile(localProfile, { name: profile.name, shortName: profile.shortName, icon: profile.icon, useDefaultFlags: profile.useDefaultFlags });
|
|
163
|
+
this.logService.info(`${this.syncResourceLogLabel}: Updated profile '${profile.name}'.`);
|
|
169
164
|
}
|
|
170
165
|
else {
|
|
171
166
|
this.logService.info(`${this.syncResourceLogLabel}: Could not find profile with id '${profile.id}' to update.`);
|
|
172
167
|
}
|
|
173
|
-
}
|
|
174
|
-
await Promise.all(promises);
|
|
168
|
+
})));
|
|
175
169
|
}
|
|
176
170
|
if (remoteChange !== 0 ) {
|
|
177
171
|
this.logService.trace(`${this.syncResourceLogLabel}: Updating remote profiles...`);
|
|
@@ -25,11 +25,13 @@ import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
|
25
25
|
import { reviveProfile } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile';
|
|
26
26
|
import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
|
|
27
27
|
import { DEFAULT_EDITOR_ASSOCIATION } from 'vscode/vscode/vs/workbench/common/editor';
|
|
28
|
+
import { IHoverService } from 'vscode/vscode/vs/platform/hover/browser/hover.service';
|
|
29
|
+
import { IAccessibleViewInformationService } from 'vscode/vscode/vs/workbench/services/accessibility/common/accessibleViewInformationService.service';
|
|
28
30
|
|
|
29
31
|
const _moduleId = "vs/workbench/contrib/userDataSync/browser/userDataSyncConflictsView";
|
|
30
32
|
let UserDataSyncConflictsViewPane = class UserDataSyncConflictsViewPane extends TreeViewPane {
|
|
31
|
-
constructor(options, editorService, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, notificationService, userDataSyncService, userDataSyncWorkbenchService, userDataSyncEnablementService, userDataProfilesService) {
|
|
32
|
-
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, notificationService);
|
|
33
|
+
constructor(options, editorService, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, notificationService, hoverService, userDataSyncService, userDataSyncWorkbenchService, userDataSyncEnablementService, userDataProfilesService, accessibleViewVisibilityService) {
|
|
34
|
+
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, notificationService, hoverService, accessibleViewVisibilityService);
|
|
33
35
|
this.editorService = editorService;
|
|
34
36
|
this.userDataSyncService = userDataSyncService;
|
|
35
37
|
this.userDataSyncWorkbenchService = userDataSyncWorkbenchService;
|
|
@@ -197,10 +199,12 @@ UserDataSyncConflictsViewPane = ( (__decorate([
|
|
|
197
199
|
( (__param(9, IThemeService))),
|
|
198
200
|
( (__param(10, ITelemetryService))),
|
|
199
201
|
( (__param(11, INotificationService))),
|
|
200
|
-
( (__param(12,
|
|
201
|
-
( (__param(13,
|
|
202
|
-
( (__param(14,
|
|
203
|
-
( (__param(15,
|
|
202
|
+
( (__param(12, IHoverService))),
|
|
203
|
+
( (__param(13, IUserDataSyncService))),
|
|
204
|
+
( (__param(14, IUserDataSyncWorkbenchService))),
|
|
205
|
+
( (__param(15, IUserDataSyncEnablementService))),
|
|
206
|
+
( (__param(16, IUserDataProfilesService))),
|
|
207
|
+
( (__param(17, IAccessibleViewInformationService)))
|
|
204
208
|
], UserDataSyncConflictsViewPane)));
|
|
205
209
|
|
|
206
210
|
export { UserDataSyncConflictsViewPane };
|
|
@@ -264,7 +264,8 @@ let UserDataSyncDataViews = class UserDataSyncDataViews extends Disposable {
|
|
|
264
264
|
id: MenuId.ViewItemContext,
|
|
265
265
|
when: ( (ContextKeyExpr.and(
|
|
266
266
|
(ContextKeyExpr.equals('view', viewId)),
|
|
267
|
-
(ContextKeyExpr.regex('viewItem', /sync-resource-.*/i))
|
|
267
|
+
(ContextKeyExpr.regex('viewItem', /sync-resource-.*/i)),
|
|
268
|
+
(ContextKeyExpr.notEquals('viewItem', `sync-resource-${"profiles" }`))
|
|
268
269
|
))),
|
|
269
270
|
group: 'inline',
|
|
270
271
|
},
|
|
@@ -72,8 +72,9 @@ import { SelectBox } from 'vscode/vscode/vs/base/browser/ui/selectBox/selectBox'
|
|
|
72
72
|
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
73
73
|
import { IHoverService } from 'vscode/vscode/vs/platform/hover/browser/hover.service';
|
|
74
74
|
import { DEFAULT_ICON, ICONS } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfileIcons';
|
|
75
|
-
import { WorkbenchIconSelectBox } from '
|
|
75
|
+
import { WorkbenchIconSelectBox } from 'vscode/vscode/vs/workbench/services/userDataProfile/browser/iconSelectBox';
|
|
76
76
|
import { StandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEvent';
|
|
77
|
+
import { IAccessibleViewInformationService } from 'vscode/vscode/vs/workbench/services/accessibility/common/accessibleViewInformationService.service';
|
|
77
78
|
|
|
78
79
|
var UserDataProfileImportExportService_1;
|
|
79
80
|
const _moduleId = "vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService";
|
|
@@ -484,6 +485,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
484
485
|
await this.doExportProfile(userDataProfilesExportState);
|
|
485
486
|
}
|
|
486
487
|
catch (error) {
|
|
488
|
+
exportAction.enabled = true;
|
|
487
489
|
this.notificationService.error(error);
|
|
488
490
|
throw error;
|
|
489
491
|
}
|
|
@@ -1036,8 +1038,8 @@ FileUserDataProfileContentHandler = ( (__decorate([
|
|
|
1036
1038
|
( (__param(3, ITextFileService)))
|
|
1037
1039
|
], FileUserDataProfileContentHandler)));
|
|
1038
1040
|
let UserDataProfilePreviewViewPane = class UserDataProfilePreviewViewPane extends TreeViewPane {
|
|
1039
|
-
constructor(userDataProfileData, primaryAction, secondaryAction, actionRunner, options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, notificationService) {
|
|
1040
|
-
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, notificationService);
|
|
1041
|
+
constructor(userDataProfileData, primaryAction, secondaryAction, actionRunner, options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, notificationService, hoverService, accessibleViewService) {
|
|
1042
|
+
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, notificationService, hoverService, accessibleViewService);
|
|
1041
1043
|
this.userDataProfileData = userDataProfileData;
|
|
1042
1044
|
this.primaryAction = primaryAction;
|
|
1043
1045
|
this.secondaryAction = secondaryAction;
|
|
@@ -1141,7 +1143,9 @@ UserDataProfilePreviewViewPane = ( (__decorate([
|
|
|
1141
1143
|
( (__param(11, IOpenerService))),
|
|
1142
1144
|
( (__param(12, IThemeService))),
|
|
1143
1145
|
( (__param(13, ITelemetryService))),
|
|
1144
|
-
( (__param(14, INotificationService)))
|
|
1146
|
+
( (__param(14, INotificationService))),
|
|
1147
|
+
( (__param(15, IHoverService))),
|
|
1148
|
+
( (__param(16, IAccessibleViewInformationService)))
|
|
1145
1149
|
], UserDataProfilePreviewViewPane)));
|
|
1146
1150
|
const USER_DATA_PROFILE_EXPORT_SCHEME = 'userdataprofileexport';
|
|
1147
1151
|
const USER_DATA_PROFILE_EXPORT_PREVIEW_SCHEME = 'userdataprofileexportpreview';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import n from 'vscode/external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
-
|
|
3
|
-
var css = ".icon-select-box>.icon-select-box-container{height:100%}.icon-select-box .icon-select-icons-container{height:100%;outline:0!important}.icon-select-box .icon-select-icons-container>.icon-container{align-items:center;border-radius:5px;cursor:pointer;display:inline-flex;font-size:20px;justify-content:center}.icon-select-box .icon-select-icons-container>.icon-container.focused{background-color:var(--vscode-quickInputList-focusBackground);color:var(--vscode-quickInputList-focusForeground)}.icon-select-box .icon-select-icons-container>.icon-container:hover:not(.focused){background-color:var(--vscode-toolbar-hoverBackground);color:var(--vscode-list-hoverForeground)}.icon-select-box .icon-select-id-container .icon-select-id-label{height:24px;opacity:.8;padding:10px}.icon-select-box .icon-select-id-container .icon-select-id-label .highlight{color:var(--vscode-list-highlightForeground);font-weight:700}";
|
|
4
|
-
n(css,{});
|
|
5
|
-
|
|
6
|
-
export { css, css as default };
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import './iconSelectBox.css.js';
|
|
2
|
-
import { $, append, clearNode, addDisposableListener, EventType } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
-
import { alert } from 'vscode/vscode/vs/base/browser/ui/aria/aria';
|
|
4
|
-
import { InputBox } from 'vscode/vscode/vs/base/browser/ui/inputbox/inputBox';
|
|
5
|
-
import { DomScrollableElement } from 'vscode/vscode/vs/base/browser/ui/scrollbar/scrollableElement';
|
|
6
|
-
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
7
|
-
import { Disposable, DisposableStore, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
8
|
-
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
9
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
10
|
-
import { HighlightedLabel } from 'vscode/vscode/vs/base/browser/ui/highlightedlabel/highlightedLabel';
|
|
11
|
-
|
|
12
|
-
const _moduleId = "vs/base/browser/ui/icons/iconSelectBox";
|
|
13
|
-
class IconSelectBox extends Disposable {
|
|
14
|
-
static { this.InstanceCount = 0; }
|
|
15
|
-
constructor(options) {
|
|
16
|
-
super();
|
|
17
|
-
this.options = options;
|
|
18
|
-
this.domId = `icon_select_box_id_${++IconSelectBox.InstanceCount}`;
|
|
19
|
-
this._onDidSelect = this._register(( (new Emitter())));
|
|
20
|
-
this.onDidSelect = this._onDidSelect.event;
|
|
21
|
-
this.renderedIcons = [];
|
|
22
|
-
this.focusedItemIndex = 0;
|
|
23
|
-
this.numberOfElementsPerRow = 1;
|
|
24
|
-
this.iconContainerWidth = 36;
|
|
25
|
-
this.iconContainerHeight = 36;
|
|
26
|
-
this.domNode = $('.icon-select-box');
|
|
27
|
-
this._register(this.create());
|
|
28
|
-
}
|
|
29
|
-
create() {
|
|
30
|
-
const disposables = ( (new DisposableStore()));
|
|
31
|
-
const iconSelectBoxContainer = append(this.domNode, $('.icon-select-box-container'));
|
|
32
|
-
iconSelectBoxContainer.style.margin = '10px 15px';
|
|
33
|
-
const iconSelectInputContainer = append(iconSelectBoxContainer, $('.icon-select-input-container'));
|
|
34
|
-
iconSelectInputContainer.style.paddingBottom = '10px';
|
|
35
|
-
this.inputBox = disposables.add(( (new InputBox(iconSelectInputContainer, undefined, {
|
|
36
|
-
placeholder: ( localizeWithPath(_moduleId, 0, "Search icons")),
|
|
37
|
-
inputBoxStyles: this.options.inputBoxStyles,
|
|
38
|
-
}))));
|
|
39
|
-
const iconsContainer = this.iconsContainer = $('.icon-select-icons-container', { id: `${this.domId}_icons` });
|
|
40
|
-
iconsContainer.role = 'listbox';
|
|
41
|
-
iconsContainer.tabIndex = 0;
|
|
42
|
-
this.scrollableElement = disposables.add(( (new DomScrollableElement(iconsContainer, {
|
|
43
|
-
useShadows: false,
|
|
44
|
-
horizontal: 2 ,
|
|
45
|
-
}))));
|
|
46
|
-
append(iconSelectBoxContainer, this.scrollableElement.getDomNode());
|
|
47
|
-
if (this.options.showIconInfo) {
|
|
48
|
-
this.iconIdElement = this._register(( (new HighlightedLabel(
|
|
49
|
-
append(append(iconSelectBoxContainer, $('.icon-select-id-container')), $('.icon-select-id-label'))
|
|
50
|
-
))));
|
|
51
|
-
}
|
|
52
|
-
const iconsDisposables = disposables.add(( (new MutableDisposable())));
|
|
53
|
-
iconsDisposables.value = this.renderIcons(this.options.icons, [], iconsContainer);
|
|
54
|
-
this.scrollableElement.scanDomNode();
|
|
55
|
-
disposables.add(this.inputBox.onDidChange(value => {
|
|
56
|
-
const icons = [], matches = [];
|
|
57
|
-
for (const icon of this.options.icons) {
|
|
58
|
-
const match = this.matchesContiguous(value, icon.id);
|
|
59
|
-
if (match) {
|
|
60
|
-
icons.push(icon);
|
|
61
|
-
matches.push(match);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (icons.length) {
|
|
65
|
-
iconsDisposables.value = this.renderIcons(icons, matches, iconsContainer);
|
|
66
|
-
this.scrollableElement?.scanDomNode();
|
|
67
|
-
}
|
|
68
|
-
}));
|
|
69
|
-
this.inputBox.inputElement.role = 'combobox';
|
|
70
|
-
this.inputBox.inputElement.ariaHasPopup = 'menu';
|
|
71
|
-
this.inputBox.inputElement.ariaAutoComplete = 'list';
|
|
72
|
-
this.inputBox.inputElement.ariaExpanded = 'true';
|
|
73
|
-
this.inputBox.inputElement.setAttribute('aria-controls', iconsContainer.id);
|
|
74
|
-
return disposables;
|
|
75
|
-
}
|
|
76
|
-
renderIcons(icons, matches, container) {
|
|
77
|
-
const disposables = ( (new DisposableStore()));
|
|
78
|
-
clearNode(container);
|
|
79
|
-
const focusedIcon = this.renderedIcons[this.focusedItemIndex]?.icon;
|
|
80
|
-
let focusedIconIndex = 0;
|
|
81
|
-
const renderedIcons = [];
|
|
82
|
-
if (icons.length) {
|
|
83
|
-
for (let index = 0; index < icons.length; index++) {
|
|
84
|
-
const icon = icons[index];
|
|
85
|
-
const iconContainer = append(container, $('.icon-container', { id: `${this.domId}_icons_${index}` }));
|
|
86
|
-
iconContainer.style.width = `${this.iconContainerWidth}px`;
|
|
87
|
-
iconContainer.style.height = `${this.iconContainerHeight}px`;
|
|
88
|
-
iconContainer.title = icon.id;
|
|
89
|
-
iconContainer.role = 'button';
|
|
90
|
-
iconContainer.setAttribute('aria-setsize', `${icons.length}`);
|
|
91
|
-
iconContainer.setAttribute('aria-posinset', `${index + 1}`);
|
|
92
|
-
append(iconContainer, $(ThemeIcon.asCSSSelector(icon)));
|
|
93
|
-
renderedIcons.push({ icon, element: iconContainer, highlightMatches: matches[index] });
|
|
94
|
-
disposables.add(addDisposableListener(iconContainer, EventType.CLICK, (e) => {
|
|
95
|
-
e.stopPropagation();
|
|
96
|
-
this.setSelection(index);
|
|
97
|
-
}));
|
|
98
|
-
if (icon === focusedIcon) {
|
|
99
|
-
focusedIconIndex = index;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
const noResults = ( localizeWithPath(_moduleId, 1, "No results"));
|
|
105
|
-
append(container, $('.icon-no-results', undefined, noResults));
|
|
106
|
-
alert(noResults);
|
|
107
|
-
}
|
|
108
|
-
this.renderedIcons.splice(0, this.renderedIcons.length, ...renderedIcons);
|
|
109
|
-
this.focusIcon(focusedIconIndex);
|
|
110
|
-
return disposables;
|
|
111
|
-
}
|
|
112
|
-
focusIcon(index) {
|
|
113
|
-
const existing = this.renderedIcons[this.focusedItemIndex];
|
|
114
|
-
if (existing) {
|
|
115
|
-
existing.element.classList.remove('focused');
|
|
116
|
-
}
|
|
117
|
-
this.focusedItemIndex = index;
|
|
118
|
-
const renderedItem = this.renderedIcons[index];
|
|
119
|
-
if (renderedItem) {
|
|
120
|
-
renderedItem.element.classList.add('focused');
|
|
121
|
-
}
|
|
122
|
-
if (this.inputBox) {
|
|
123
|
-
if (renderedItem) {
|
|
124
|
-
this.inputBox.inputElement.setAttribute('aria-activedescendant', renderedItem.element.id);
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
this.inputBox.inputElement.removeAttribute('aria-activedescendant');
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
if (this.iconIdElement) {
|
|
131
|
-
if (renderedItem) {
|
|
132
|
-
this.iconIdElement.set(renderedItem.icon.id, renderedItem.highlightMatches);
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
this.iconIdElement.set('');
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
this.reveal(index);
|
|
139
|
-
}
|
|
140
|
-
reveal(index) {
|
|
141
|
-
if (!this.scrollableElement) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (index < 0 || index >= this.renderedIcons.length) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
const element = this.renderedIcons[index].element;
|
|
148
|
-
if (!element) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
const { height } = this.scrollableElement.getScrollDimensions();
|
|
152
|
-
const { scrollTop } = this.scrollableElement.getScrollPosition();
|
|
153
|
-
if (element.offsetTop + this.iconContainerHeight > scrollTop + height) {
|
|
154
|
-
this.scrollableElement.setScrollPosition({ scrollTop: element.offsetTop + this.iconContainerHeight - height });
|
|
155
|
-
}
|
|
156
|
-
else if (element.offsetTop < scrollTop) {
|
|
157
|
-
this.scrollableElement.setScrollPosition({ scrollTop: element.offsetTop });
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
matchesContiguous(word, wordToMatchAgainst) {
|
|
161
|
-
const matchIndex = wordToMatchAgainst.toLowerCase().indexOf(word.toLowerCase());
|
|
162
|
-
if (matchIndex !== -1) {
|
|
163
|
-
return [{ start: matchIndex, end: matchIndex + word.length }];
|
|
164
|
-
}
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
layout(dimension) {
|
|
168
|
-
this.domNode.style.width = `${dimension.width}px`;
|
|
169
|
-
this.domNode.style.height = `${dimension.height}px`;
|
|
170
|
-
const iconsContainerWidth = dimension.width - 30;
|
|
171
|
-
this.numberOfElementsPerRow = Math.floor(iconsContainerWidth / this.iconContainerWidth);
|
|
172
|
-
if (this.numberOfElementsPerRow === 0) {
|
|
173
|
-
throw ( (new Error('Insufficient width')));
|
|
174
|
-
}
|
|
175
|
-
const extraSpace = iconsContainerWidth % this.iconContainerWidth;
|
|
176
|
-
const iconElementMargin = Math.floor(extraSpace / this.numberOfElementsPerRow);
|
|
177
|
-
for (const { element } of this.renderedIcons) {
|
|
178
|
-
element.style.marginRight = `${iconElementMargin}px`;
|
|
179
|
-
}
|
|
180
|
-
const containerPadding = extraSpace % this.numberOfElementsPerRow;
|
|
181
|
-
if (this.iconsContainer) {
|
|
182
|
-
this.iconsContainer.style.paddingLeft = `${Math.floor(containerPadding / 2)}px`;
|
|
183
|
-
this.iconsContainer.style.paddingRight = `${Math.ceil(containerPadding / 2)}px`;
|
|
184
|
-
}
|
|
185
|
-
if (this.scrollableElement) {
|
|
186
|
-
this.scrollableElement.getDomNode().style.height = `${this.iconIdElement ? dimension.height - 80 : dimension.height - 40}px`;
|
|
187
|
-
this.scrollableElement.scanDomNode();
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
getFocus() {
|
|
191
|
-
return [this.focusedItemIndex];
|
|
192
|
-
}
|
|
193
|
-
setSelection(index) {
|
|
194
|
-
if (index < 0 || index >= this.renderedIcons.length) {
|
|
195
|
-
throw ( (new Error(`Invalid index ${index}`)));
|
|
196
|
-
}
|
|
197
|
-
this.focusIcon(index);
|
|
198
|
-
this._onDidSelect.fire(this.renderedIcons[index].icon);
|
|
199
|
-
}
|
|
200
|
-
clearInput() {
|
|
201
|
-
if (this.inputBox) {
|
|
202
|
-
this.inputBox.value = '';
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
focus() {
|
|
206
|
-
this.inputBox?.focus();
|
|
207
|
-
this.focusIcon(0);
|
|
208
|
-
}
|
|
209
|
-
focusNext() {
|
|
210
|
-
this.focusIcon((this.focusedItemIndex + 1) % this.renderedIcons.length);
|
|
211
|
-
}
|
|
212
|
-
focusPrevious() {
|
|
213
|
-
this.focusIcon((this.focusedItemIndex - 1 + this.renderedIcons.length) % this.renderedIcons.length);
|
|
214
|
-
}
|
|
215
|
-
focusNextRow() {
|
|
216
|
-
let nextRowIndex = this.focusedItemIndex + this.numberOfElementsPerRow;
|
|
217
|
-
if (nextRowIndex >= this.renderedIcons.length) {
|
|
218
|
-
nextRowIndex = (nextRowIndex + 1) % this.numberOfElementsPerRow;
|
|
219
|
-
nextRowIndex = nextRowIndex >= this.renderedIcons.length ? 0 : nextRowIndex;
|
|
220
|
-
}
|
|
221
|
-
this.focusIcon(nextRowIndex);
|
|
222
|
-
}
|
|
223
|
-
focusPreviousRow() {
|
|
224
|
-
let previousRowIndex = this.focusedItemIndex - this.numberOfElementsPerRow;
|
|
225
|
-
if (previousRowIndex < 0) {
|
|
226
|
-
const numberOfRows = Math.floor(this.renderedIcons.length / this.numberOfElementsPerRow);
|
|
227
|
-
previousRowIndex = this.focusedItemIndex + (this.numberOfElementsPerRow * numberOfRows) - 1;
|
|
228
|
-
previousRowIndex = previousRowIndex < 0
|
|
229
|
-
? this.renderedIcons.length - 1
|
|
230
|
-
: previousRowIndex >= this.renderedIcons.length
|
|
231
|
-
? previousRowIndex - this.numberOfElementsPerRow
|
|
232
|
-
: previousRowIndex;
|
|
233
|
-
}
|
|
234
|
-
this.focusIcon(previousRowIndex);
|
|
235
|
-
}
|
|
236
|
-
getFocusedIcon() {
|
|
237
|
-
return this.renderedIcons[this.focusedItemIndex].icon;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export { IconSelectBox };
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { IconSelectBox } from '../../../../base/browser/ui/icons/iconSelectBox.js';
|
|
3
|
-
import { trackFocus } from 'vscode/vscode/vs/base/browser/dom';
|
|
4
|
-
import { RawContextKey, ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
5
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
6
|
-
import { KeybindingsRegistry } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
7
|
-
|
|
8
|
-
var WorkbenchIconSelectBox_1;
|
|
9
|
-
const WorkbenchIconSelectBoxFocusContextKey = ( new RawContextKey('iconSelectBoxFocus', true));
|
|
10
|
-
const WorkbenchIconSelectBoxInputFocusContextKey = ( new RawContextKey('iconSelectBoxInputFocus', true));
|
|
11
|
-
const WorkbenchIconSelectBoxInputEmptyContextKey = ( new RawContextKey('iconSelectBoxInputEmpty', true));
|
|
12
|
-
let WorkbenchIconSelectBox = class WorkbenchIconSelectBox extends IconSelectBox {
|
|
13
|
-
static { WorkbenchIconSelectBox_1 = this; }
|
|
14
|
-
static getFocusedWidget() {
|
|
15
|
-
return WorkbenchIconSelectBox_1.focusedWidget;
|
|
16
|
-
}
|
|
17
|
-
constructor(options, contextKeyService) {
|
|
18
|
-
super(options);
|
|
19
|
-
this.contextKeyService = this._register(contextKeyService.createScoped(this.domNode));
|
|
20
|
-
WorkbenchIconSelectBoxFocusContextKey.bindTo(this.contextKeyService);
|
|
21
|
-
this.inputFocusContextKey = WorkbenchIconSelectBoxInputFocusContextKey.bindTo(this.contextKeyService);
|
|
22
|
-
this.inputEmptyContextKey = WorkbenchIconSelectBoxInputEmptyContextKey.bindTo(this.contextKeyService);
|
|
23
|
-
if (this.inputBox) {
|
|
24
|
-
const focusTracker = this._register(trackFocus(this.inputBox.inputElement));
|
|
25
|
-
this._register(focusTracker.onDidFocus(() => this.inputFocusContextKey.set(true)));
|
|
26
|
-
this._register(focusTracker.onDidBlur(() => this.inputFocusContextKey.set(false)));
|
|
27
|
-
this._register(this.inputBox.onDidChange(() => this.inputEmptyContextKey.set(this.inputBox?.value.length === 0)));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
focus() {
|
|
31
|
-
super.focus();
|
|
32
|
-
WorkbenchIconSelectBox_1.focusedWidget = this;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
WorkbenchIconSelectBox = WorkbenchIconSelectBox_1 = ( __decorate([
|
|
36
|
-
( __param(1, IContextKeyService))
|
|
37
|
-
], WorkbenchIconSelectBox));
|
|
38
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
39
|
-
id: 'iconSelectBox.focusUp',
|
|
40
|
-
weight: 200 ,
|
|
41
|
-
when: WorkbenchIconSelectBoxFocusContextKey,
|
|
42
|
-
primary: 16 ,
|
|
43
|
-
handler: () => {
|
|
44
|
-
const selectBox = WorkbenchIconSelectBox.getFocusedWidget();
|
|
45
|
-
if (selectBox) {
|
|
46
|
-
selectBox.focusPreviousRow();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
51
|
-
id: 'iconSelectBox.focusDown',
|
|
52
|
-
weight: 200 ,
|
|
53
|
-
when: WorkbenchIconSelectBoxFocusContextKey,
|
|
54
|
-
primary: 18 ,
|
|
55
|
-
handler: () => {
|
|
56
|
-
const selectBox = WorkbenchIconSelectBox.getFocusedWidget();
|
|
57
|
-
if (selectBox) {
|
|
58
|
-
selectBox.focusNextRow();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
63
|
-
id: 'iconSelectBox.focusNext',
|
|
64
|
-
weight: 200 ,
|
|
65
|
-
when: ( ContextKeyExpr.and(WorkbenchIconSelectBoxFocusContextKey, ( ContextKeyExpr.or(WorkbenchIconSelectBoxInputEmptyContextKey, ( WorkbenchIconSelectBoxInputFocusContextKey.toNegated()))))),
|
|
66
|
-
primary: 17 ,
|
|
67
|
-
handler: () => {
|
|
68
|
-
const selectBox = WorkbenchIconSelectBox.getFocusedWidget();
|
|
69
|
-
if (selectBox) {
|
|
70
|
-
selectBox.focusNext();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
75
|
-
id: 'iconSelectBox.focusPrevious',
|
|
76
|
-
weight: 200 ,
|
|
77
|
-
when: ( ContextKeyExpr.and(WorkbenchIconSelectBoxFocusContextKey, ( ContextKeyExpr.or(WorkbenchIconSelectBoxInputEmptyContextKey, ( WorkbenchIconSelectBoxInputFocusContextKey.toNegated()))))),
|
|
78
|
-
primary: 15 ,
|
|
79
|
-
handler: () => {
|
|
80
|
-
const selectBox = WorkbenchIconSelectBox.getFocusedWidget();
|
|
81
|
-
if (selectBox) {
|
|
82
|
-
selectBox.focusPrevious();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
87
|
-
id: 'iconSelectBox.selectFocused',
|
|
88
|
-
weight: 200 ,
|
|
89
|
-
when: WorkbenchIconSelectBoxFocusContextKey,
|
|
90
|
-
primary: 3 ,
|
|
91
|
-
handler: () => {
|
|
92
|
-
const selectBox = WorkbenchIconSelectBox.getFocusedWidget();
|
|
93
|
-
if (selectBox) {
|
|
94
|
-
selectBox.setSelection(selectBox.getFocus()[0]);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
export { WorkbenchIconSelectBox, WorkbenchIconSelectBoxFocusContextKey, WorkbenchIconSelectBoxInputEmptyContextKey, WorkbenchIconSelectBoxInputFocusContextKey };
|