@codingame/monaco-vscode-user-data-sync-service-override 1.85.2
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/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/override/vs/platform/dialogs/common/dialogs.js +8 -0
- package/override/vs/platform/userDataSync/common/extensionsSync.js +4 -0
- package/override/vs/platform/userDataSync/common/globalStateSync.js +5 -0
- package/package.json +24 -0
- package/userDataSync.d.ts +5 -0
- package/userDataSync.js +106 -0
- package/vscode/src/vs/base/browser/ui/icons/iconSelectBox.css.js +6 -0
- package/vscode/src/vs/base/browser/ui/icons/iconSelectBox.js +248 -0
- package/vscode/src/vs/platform/userDataProfile/browser/userDataProfile.js +95 -0
- package/vscode/src/vs/platform/userDataProfile/common/userDataProfileStorageService.js +5 -0
- package/vscode/src/vs/platform/userDataSync/common/abstractSynchronizer.js +774 -0
- package/vscode/src/vs/platform/userDataSync/common/extensionsSync.js +251 -0
- package/vscode/src/vs/platform/userDataSync/common/globalStateSync.js +115 -0
- package/vscode/src/vs/platform/userDataSync/common/keybindingsMerge.js +277 -0
- package/vscode/src/vs/platform/userDataSync/common/keybindingsSync.js +318 -0
- package/vscode/src/vs/platform/userDataSync/common/settingsSync.js +316 -0
- package/vscode/src/vs/platform/userDataSync/common/snippetsMerge.js +126 -0
- package/vscode/src/vs/platform/userDataSync/common/snippetsSync.js +476 -0
- package/vscode/src/vs/platform/userDataSync/common/tasksSync.js +244 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataAutoSyncService.js +466 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestMerge.js +92 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestSync.js +261 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncEnablementService.js +77 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncLocalStoreService.js +150 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncLog.js +41 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncResourceProvider.js +449 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncService.js +783 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncStoreService.js +553 -0
- package/vscode/src/vs/workbench/browser/iconSelectBox.js +98 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.contribution.js +111 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.js +1467 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncConflictsView.js +225 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger.js +61 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.js +860 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +342 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +147 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +119 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/media/userDataProfileView.css.js +6 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +140 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +155 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +118 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +1753 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileInit.js +150 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +190 -0
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncEnablementService.js +10 -0
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncInit.js +447 -0
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.js +786 -0
- package/vscode/src/vs/workbench/services/userDataSync/browser/webUserDataSyncEnablementService.js +40 -0
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.js +48 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=( Object.keys(r.attributes)),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
2
|
+
|
|
3
|
+
export { n as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function __decorate(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
}
|
|
7
|
+
function __param(paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { __decorate, __param };
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './userDataSync.js';
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './userDataSync.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var ConfirmResult;
|
|
2
|
+
( (function(ConfirmResult) {
|
|
3
|
+
ConfirmResult[ConfirmResult["SAVE"] = 0] = "SAVE";
|
|
4
|
+
ConfirmResult[ConfirmResult["DONT_SAVE"] = 1] = "DONT_SAVE";
|
|
5
|
+
ConfirmResult[ConfirmResult["CANCEL"] = 2] = "CANCEL";
|
|
6
|
+
})(ConfirmResult || (ConfirmResult = {})));
|
|
7
|
+
|
|
8
|
+
export { ConfirmResult };
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codingame/monaco-vscode-user-data-sync-service-override",
|
|
3
|
+
"version": "1.85.2",
|
|
4
|
+
"keywords": [],
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "CodinGame",
|
|
7
|
+
"url": "http://www.codingame.com"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/CodinGame/monaco-vscode-api.git"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"private": false,
|
|
16
|
+
"description": "VSCode public API plugged on the monaco editor - user-data-sync service-override",
|
|
17
|
+
"main": "index.js",
|
|
18
|
+
"module": "index.js",
|
|
19
|
+
"types": "index.d.ts",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.85.2",
|
|
22
|
+
"monaco-editor": "0.45.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/userDataSync.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { __decorate, __param } from './external/tslib/tslib.es6.js';
|
|
2
|
+
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
3
|
+
import { IUserDataAutoSyncService, IUserDataSyncStoreManagementService, IUserDataSyncStoreService, IUserDataSyncEnablementService, IUserDataSyncService, IUserDataSyncLogService, IUserDataSyncResourceProviderService, IUserDataSyncLocalStoreService, IUserDataSyncUtilService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
4
|
+
import { IUserDataSyncAccountService, UserDataSyncAccountService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSyncAccount';
|
|
5
|
+
import { IUserDataSyncMachinesService, UserDataSyncMachinesService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSyncMachines';
|
|
6
|
+
import { UserDataSyncStoreManagementService, UserDataSyncStoreService } from './vscode/src/vs/platform/userDataSync/common/userDataSyncStoreService.js';
|
|
7
|
+
import { UserDataAutoSyncService } from './vscode/src/vs/platform/userDataSync/common/userDataAutoSyncService.js';
|
|
8
|
+
import { WebUserDataSyncEnablementService } from './vscode/src/vs/workbench/services/userDataSync/browser/webUserDataSyncEnablementService.js';
|
|
9
|
+
import { UserDataSyncService } from './vscode/src/vs/platform/userDataSync/common/userDataSyncService.js';
|
|
10
|
+
import { UserDataSyncLogService } from './vscode/src/vs/platform/userDataSync/common/userDataSyncLog.js';
|
|
11
|
+
import { BrowserUserDataProfilesService } from './vscode/src/vs/platform/userDataProfile/browser/userDataProfile.js';
|
|
12
|
+
import { IUserDataProfilesService } from 'monaco-editor/esm/vs/platform/userDataProfile/common/userDataProfile.js';
|
|
13
|
+
import { UserDataSyncResourceProviderService } from './vscode/src/vs/platform/userDataSync/common/userDataSyncResourceProvider.js';
|
|
14
|
+
import { UserDataSyncLocalStoreService } from './vscode/src/vs/platform/userDataSync/common/userDataSyncLocalStoreService.js';
|
|
15
|
+
import { UserDataSyncWorkbenchService } from './vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.js';
|
|
16
|
+
import { IUserDataSyncWorkbenchService } from 'vscode/vscode/vs/workbench/services/userDataSync/common/userDataSync';
|
|
17
|
+
import './vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.contribution.js';
|
|
18
|
+
import { IUserDataInitializationService, UserDataInitializationService } from 'vscode/vscode/vs/workbench/services/userData/browser/userDataInit';
|
|
19
|
+
import { UserDataSyncInitializer } from './vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncInit.js';
|
|
20
|
+
import { UserDataProfileInitializer } from './vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileInit.js';
|
|
21
|
+
import { IBrowserWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/browser/environmentService';
|
|
22
|
+
import { ISecretStorageService } from 'vscode/vscode/vs/platform/secrets/common/secrets';
|
|
23
|
+
import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
24
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
25
|
+
import { IProductService } from 'monaco-editor/esm/vs/platform/product/common/productService.js';
|
|
26
|
+
import { IRequestService } from 'vscode/vscode/vs/platform/request/common/request';
|
|
27
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
28
|
+
import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
|
|
29
|
+
import { IUserDataProfileImportExportService, IUserDataProfileManagementService, IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
|
|
30
|
+
import { mark } from 'monaco-editor/esm/vs/base/common/performance.js';
|
|
31
|
+
import { timeout } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
32
|
+
import { IWorkbenchConfigurationService } from 'vscode/vscode/vs/workbench/services/configuration/common/configuration';
|
|
33
|
+
import { UserDataSyncUtilService } from './vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.js';
|
|
34
|
+
import { UserDataProfileImportExportService } from './vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js';
|
|
35
|
+
import { UserDataProfileManagementService } from './vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js';
|
|
36
|
+
import { registerServiceInitializePostParticipant } from 'vscode/lifecycle';
|
|
37
|
+
|
|
38
|
+
function isWorkspaceService(configurationService) {
|
|
39
|
+
return 'reloadLocalUserConfiguration' in configurationService;
|
|
40
|
+
}
|
|
41
|
+
async function initializeUserData(userDataInitializationService, configurationService) {
|
|
42
|
+
if (await userDataInitializationService.requiresInitialization()) {
|
|
43
|
+
mark('code/willInitRequiredUserData');
|
|
44
|
+
await userDataInitializationService.initializeRequiredResources();
|
|
45
|
+
if (isWorkspaceService(configurationService)) {
|
|
46
|
+
await configurationService.reloadLocalUserConfiguration();
|
|
47
|
+
}
|
|
48
|
+
mark('code/didInitRequiredUserData');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
registerServiceInitializePostParticipant(async (accessor) => {
|
|
52
|
+
try {
|
|
53
|
+
await Promise.race([
|
|
54
|
+
timeout(5000),
|
|
55
|
+
initializeUserData(accessor.get(IUserDataInitializationService), accessor.get(IWorkbenchConfigurationService))
|
|
56
|
+
]);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
accessor.get(ILogService).error(error);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
let InjectedUserDataInitializationService = class InjectedUserDataInitializationService extends UserDataInitializationService {
|
|
63
|
+
constructor(environmentService, secretStorageService, userDataSyncStoreManagementService, fileService, userDataProfilesService, storageService, productService, requestService, logService, uriIdentityService, userDataProfileService) {
|
|
64
|
+
const userDataInitializers = [];
|
|
65
|
+
userDataInitializers.push(new UserDataSyncInitializer(environmentService, secretStorageService, userDataSyncStoreManagementService, fileService, userDataProfilesService, storageService, productService, requestService, logService, uriIdentityService));
|
|
66
|
+
if (environmentService.options?.profile != null) {
|
|
67
|
+
userDataInitializers.push(new UserDataProfileInitializer(environmentService, fileService, userDataProfileService, storageService, logService, uriIdentityService, requestService));
|
|
68
|
+
}
|
|
69
|
+
super(userDataInitializers);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
InjectedUserDataInitializationService = __decorate([
|
|
73
|
+
( __param(0, IBrowserWorkbenchEnvironmentService)),
|
|
74
|
+
( __param(1, ISecretStorageService)),
|
|
75
|
+
( __param(2, IUserDataSyncStoreManagementService)),
|
|
76
|
+
( __param(3, IFileService)),
|
|
77
|
+
( __param(4, IUserDataProfilesService)),
|
|
78
|
+
( __param(5, IStorageService)),
|
|
79
|
+
( __param(6, IProductService)),
|
|
80
|
+
( __param(7, IRequestService)),
|
|
81
|
+
( __param(8, ILogService)),
|
|
82
|
+
( __param(9, IUriIdentityService)),
|
|
83
|
+
( __param(10, IUserDataProfileService))
|
|
84
|
+
], InjectedUserDataInitializationService);
|
|
85
|
+
function getServiceOverride() {
|
|
86
|
+
return {
|
|
87
|
+
[( IUserDataAutoSyncService.toString())]: new SyncDescriptor(UserDataAutoSyncService, [], true),
|
|
88
|
+
[( IUserDataSyncStoreManagementService.toString())]: new SyncDescriptor(UserDataSyncStoreManagementService, [], true),
|
|
89
|
+
[( IUserDataSyncStoreService.toString())]: new SyncDescriptor(UserDataSyncStoreService, [], true),
|
|
90
|
+
[( IUserDataSyncEnablementService.toString())]: new SyncDescriptor(WebUserDataSyncEnablementService, [], true),
|
|
91
|
+
[( IUserDataSyncService.toString())]: new SyncDescriptor(UserDataSyncService, [], true),
|
|
92
|
+
[( IUserDataSyncLogService.toString())]: new SyncDescriptor(UserDataSyncLogService, [], true),
|
|
93
|
+
[( IUserDataSyncAccountService.toString())]: new SyncDescriptor(UserDataSyncAccountService, [], true),
|
|
94
|
+
[( IUserDataSyncMachinesService.toString())]: new SyncDescriptor(UserDataSyncMachinesService, [], true),
|
|
95
|
+
[( IUserDataProfilesService.toString())]: new SyncDescriptor(BrowserUserDataProfilesService, [], true),
|
|
96
|
+
[( IUserDataSyncResourceProviderService.toString())]: new SyncDescriptor(UserDataSyncResourceProviderService, [], true),
|
|
97
|
+
[( IUserDataSyncLocalStoreService.toString())]: new SyncDescriptor(UserDataSyncLocalStoreService, [], true),
|
|
98
|
+
[( IUserDataSyncWorkbenchService.toString())]: new SyncDescriptor(UserDataSyncWorkbenchService, [], true),
|
|
99
|
+
[( IUserDataInitializationService.toString())]: new SyncDescriptor(InjectedUserDataInitializationService, [], true),
|
|
100
|
+
[( IUserDataSyncUtilService.toString())]: new SyncDescriptor(UserDataSyncUtilService, [], true),
|
|
101
|
+
[( IUserDataProfileImportExportService.toString())]: new SyncDescriptor(UserDataProfileImportExportService, [], true),
|
|
102
|
+
[( IUserDataProfileManagementService.toString())]: new SyncDescriptor(UserDataProfileManagementService, [], true)
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { getServiceOverride as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import n from '../../../../../../../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 };
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import './iconSelectBox.css.js';
|
|
2
|
+
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
3
|
+
import { alert } from 'monaco-editor/esm/vs/base/browser/ui/aria/aria.js';
|
|
4
|
+
import { InputBox } from 'monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.js';
|
|
5
|
+
import { DomScrollableElement } from 'monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js';
|
|
6
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
7
|
+
import { Disposable, DisposableStore, MutableDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
8
|
+
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
9
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
10
|
+
import { HighlightedLabel } from 'monaco-editor/esm/vs/base/browser/ui/highlightedlabel/highlightedLabel.js';
|
|
11
|
+
|
|
12
|
+
class IconSelectBox extends Disposable {
|
|
13
|
+
static { this.InstanceCount = 0; }
|
|
14
|
+
constructor(options) {
|
|
15
|
+
super();
|
|
16
|
+
this.options = options;
|
|
17
|
+
this.domId = `icon_select_box_id_${++IconSelectBox.InstanceCount}`;
|
|
18
|
+
this._onDidSelect = this._register(( new Emitter()));
|
|
19
|
+
this.onDidSelect = this._onDidSelect.event;
|
|
20
|
+
this.renderedIcons = [];
|
|
21
|
+
this.focusedItemIndex = 0;
|
|
22
|
+
this.numberOfElementsPerRow = 1;
|
|
23
|
+
this.iconContainerWidth = 36;
|
|
24
|
+
this.iconContainerHeight = 36;
|
|
25
|
+
this.domNode = dom.$('.icon-select-box');
|
|
26
|
+
this._register(this.create());
|
|
27
|
+
}
|
|
28
|
+
create() {
|
|
29
|
+
const disposables = ( new DisposableStore());
|
|
30
|
+
const iconSelectBoxContainer = dom.append(this.domNode, dom.$('.icon-select-box-container'));
|
|
31
|
+
iconSelectBoxContainer.style.margin = '10px 15px';
|
|
32
|
+
const iconSelectInputContainer = dom.append(iconSelectBoxContainer, dom.$('.icon-select-input-container'));
|
|
33
|
+
iconSelectInputContainer.style.paddingBottom = '10px';
|
|
34
|
+
this.inputBox = disposables.add(( new InputBox(iconSelectInputContainer, undefined, {
|
|
35
|
+
placeholder: ( localizeWithPath(
|
|
36
|
+
'vs/base/browser/ui/icons/iconSelectBox',
|
|
37
|
+
'iconSelect.placeholder',
|
|
38
|
+
"Search icons"
|
|
39
|
+
)),
|
|
40
|
+
inputBoxStyles: this.options.inputBoxStyles,
|
|
41
|
+
})));
|
|
42
|
+
const iconsContainer = this.iconsContainer = dom.$('.icon-select-icons-container', { id: `${this.domId}_icons` });
|
|
43
|
+
iconsContainer.role = 'listbox';
|
|
44
|
+
iconsContainer.tabIndex = 0;
|
|
45
|
+
this.scrollableElement = disposables.add(( new DomScrollableElement(iconsContainer, {
|
|
46
|
+
useShadows: false,
|
|
47
|
+
horizontal: 2 ,
|
|
48
|
+
})));
|
|
49
|
+
dom.append(iconSelectBoxContainer, this.scrollableElement.getDomNode());
|
|
50
|
+
if (this.options.showIconInfo) {
|
|
51
|
+
this.iconIdElement = ( new HighlightedLabel(
|
|
52
|
+
dom.append(dom.append(iconSelectBoxContainer, dom.$('.icon-select-id-container')), dom.$('.icon-select-id-label'))
|
|
53
|
+
));
|
|
54
|
+
}
|
|
55
|
+
const iconsDisposables = disposables.add(( new MutableDisposable()));
|
|
56
|
+
iconsDisposables.value = this.renderIcons(this.options.icons, [], iconsContainer);
|
|
57
|
+
this.scrollableElement.scanDomNode();
|
|
58
|
+
disposables.add(this.inputBox.onDidChange(value => {
|
|
59
|
+
const icons = [], matches = [];
|
|
60
|
+
for (const icon of this.options.icons) {
|
|
61
|
+
const match = this.matchesContiguous(value, icon.id);
|
|
62
|
+
if (match) {
|
|
63
|
+
icons.push(icon);
|
|
64
|
+
matches.push(match);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (icons.length) {
|
|
68
|
+
iconsDisposables.value = this.renderIcons(icons, matches, iconsContainer);
|
|
69
|
+
this.scrollableElement?.scanDomNode();
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
this.inputBox.inputElement.role = 'combobox';
|
|
73
|
+
this.inputBox.inputElement.ariaHasPopup = 'menu';
|
|
74
|
+
this.inputBox.inputElement.ariaAutoComplete = 'list';
|
|
75
|
+
this.inputBox.inputElement.ariaExpanded = 'true';
|
|
76
|
+
this.inputBox.inputElement.setAttribute('aria-controls', iconsContainer.id);
|
|
77
|
+
return disposables;
|
|
78
|
+
}
|
|
79
|
+
renderIcons(icons, matches, container) {
|
|
80
|
+
const disposables = ( new DisposableStore());
|
|
81
|
+
dom.clearNode(container);
|
|
82
|
+
const focusedIcon = this.renderedIcons[this.focusedItemIndex]?.icon;
|
|
83
|
+
let focusedIconIndex = 0;
|
|
84
|
+
const renderedIcons = [];
|
|
85
|
+
if (icons.length) {
|
|
86
|
+
for (let index = 0; index < icons.length; index++) {
|
|
87
|
+
const icon = icons[index];
|
|
88
|
+
const iconContainer = dom.append(container, dom.$('.icon-container', { id: `${this.domId}_icons_${index}` }));
|
|
89
|
+
iconContainer.style.width = `${this.iconContainerWidth}px`;
|
|
90
|
+
iconContainer.style.height = `${this.iconContainerHeight}px`;
|
|
91
|
+
iconContainer.title = icon.id;
|
|
92
|
+
iconContainer.role = 'button';
|
|
93
|
+
iconContainer.setAttribute('aria-setsize', `${icons.length}`);
|
|
94
|
+
iconContainer.setAttribute('aria-posinset', `${index + 1}`);
|
|
95
|
+
dom.append(iconContainer, dom.$(ThemeIcon.asCSSSelector(icon)));
|
|
96
|
+
renderedIcons.push({ icon, element: iconContainer, highlightMatches: matches[index] });
|
|
97
|
+
disposables.add(dom.addDisposableListener(iconContainer, dom.EventType.CLICK, (e) => {
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
this.setSelection(index);
|
|
100
|
+
}));
|
|
101
|
+
if (icon === focusedIcon) {
|
|
102
|
+
focusedIconIndex = index;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
const noResults = ( localizeWithPath(
|
|
108
|
+
'vs/base/browser/ui/icons/iconSelectBox',
|
|
109
|
+
'iconSelect.noResults',
|
|
110
|
+
"No results"
|
|
111
|
+
));
|
|
112
|
+
dom.append(container, dom.$('.icon-no-results', undefined, noResults));
|
|
113
|
+
alert(noResults);
|
|
114
|
+
}
|
|
115
|
+
this.renderedIcons.splice(0, this.renderedIcons.length, ...renderedIcons);
|
|
116
|
+
this.focusIcon(focusedIconIndex);
|
|
117
|
+
return disposables;
|
|
118
|
+
}
|
|
119
|
+
focusIcon(index) {
|
|
120
|
+
const existing = this.renderedIcons[this.focusedItemIndex];
|
|
121
|
+
if (existing) {
|
|
122
|
+
existing.element.classList.remove('focused');
|
|
123
|
+
}
|
|
124
|
+
this.focusedItemIndex = index;
|
|
125
|
+
const renderedItem = this.renderedIcons[index];
|
|
126
|
+
if (renderedItem) {
|
|
127
|
+
renderedItem.element.classList.add('focused');
|
|
128
|
+
}
|
|
129
|
+
if (this.inputBox) {
|
|
130
|
+
if (renderedItem) {
|
|
131
|
+
this.inputBox.inputElement.setAttribute('aria-activedescendant', renderedItem.element.id);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
this.inputBox.inputElement.removeAttribute('aria-activedescendant');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (this.iconIdElement) {
|
|
138
|
+
if (renderedItem) {
|
|
139
|
+
this.iconIdElement.set(renderedItem.icon.id, renderedItem.highlightMatches);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
this.iconIdElement.set('');
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
this.reveal(index);
|
|
146
|
+
}
|
|
147
|
+
reveal(index) {
|
|
148
|
+
if (!this.scrollableElement) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (index < 0 || index >= this.renderedIcons.length) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const element = this.renderedIcons[index].element;
|
|
155
|
+
if (!element) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const { height } = this.scrollableElement.getScrollDimensions();
|
|
159
|
+
const { scrollTop } = this.scrollableElement.getScrollPosition();
|
|
160
|
+
if (element.offsetTop + this.iconContainerHeight > scrollTop + height) {
|
|
161
|
+
this.scrollableElement.setScrollPosition({ scrollTop: element.offsetTop + this.iconContainerHeight - height });
|
|
162
|
+
}
|
|
163
|
+
else if (element.offsetTop < scrollTop) {
|
|
164
|
+
this.scrollableElement.setScrollPosition({ scrollTop: element.offsetTop });
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
matchesContiguous(word, wordToMatchAgainst) {
|
|
168
|
+
const matchIndex = wordToMatchAgainst.toLowerCase().indexOf(word.toLowerCase());
|
|
169
|
+
if (matchIndex !== -1) {
|
|
170
|
+
return [{ start: matchIndex, end: matchIndex + word.length }];
|
|
171
|
+
}
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
layout(dimension) {
|
|
175
|
+
this.domNode.style.width = `${dimension.width}px`;
|
|
176
|
+
this.domNode.style.height = `${dimension.height}px`;
|
|
177
|
+
const iconsContainerWidth = dimension.width - 30;
|
|
178
|
+
this.numberOfElementsPerRow = Math.floor(iconsContainerWidth / this.iconContainerWidth);
|
|
179
|
+
if (this.numberOfElementsPerRow === 0) {
|
|
180
|
+
throw new Error('Insufficient width');
|
|
181
|
+
}
|
|
182
|
+
const extraSpace = iconsContainerWidth % this.iconContainerWidth;
|
|
183
|
+
const iconElementMargin = Math.floor(extraSpace / this.numberOfElementsPerRow);
|
|
184
|
+
for (const { element } of this.renderedIcons) {
|
|
185
|
+
element.style.marginRight = `${iconElementMargin}px`;
|
|
186
|
+
}
|
|
187
|
+
const containerPadding = extraSpace % this.numberOfElementsPerRow;
|
|
188
|
+
if (this.iconsContainer) {
|
|
189
|
+
this.iconsContainer.style.paddingLeft = `${Math.floor(containerPadding / 2)}px`;
|
|
190
|
+
this.iconsContainer.style.paddingRight = `${Math.ceil(containerPadding / 2)}px`;
|
|
191
|
+
}
|
|
192
|
+
if (this.scrollableElement) {
|
|
193
|
+
this.scrollableElement.getDomNode().style.height = `${this.iconIdElement ? dimension.height - 80 : dimension.height - 40}px`;
|
|
194
|
+
this.scrollableElement.scanDomNode();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
getFocus() {
|
|
198
|
+
return [this.focusedItemIndex];
|
|
199
|
+
}
|
|
200
|
+
setSelection(index) {
|
|
201
|
+
if (index < 0 || index >= this.renderedIcons.length) {
|
|
202
|
+
throw new Error(`Invalid index ${index}`);
|
|
203
|
+
}
|
|
204
|
+
this.focusIcon(index);
|
|
205
|
+
this._onDidSelect.fire(this.renderedIcons[index].icon);
|
|
206
|
+
}
|
|
207
|
+
clearInput() {
|
|
208
|
+
if (this.inputBox) {
|
|
209
|
+
this.inputBox.value = '';
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
focus() {
|
|
213
|
+
this.inputBox?.focus();
|
|
214
|
+
this.focusIcon(0);
|
|
215
|
+
}
|
|
216
|
+
focusNext() {
|
|
217
|
+
this.focusIcon((this.focusedItemIndex + 1) % this.renderedIcons.length);
|
|
218
|
+
}
|
|
219
|
+
focusPrevious() {
|
|
220
|
+
this.focusIcon((this.focusedItemIndex - 1 + this.renderedIcons.length) % this.renderedIcons.length);
|
|
221
|
+
}
|
|
222
|
+
focusNextRow() {
|
|
223
|
+
let nextRowIndex = this.focusedItemIndex + this.numberOfElementsPerRow;
|
|
224
|
+
if (nextRowIndex >= this.renderedIcons.length) {
|
|
225
|
+
nextRowIndex = (nextRowIndex + 1) % this.numberOfElementsPerRow;
|
|
226
|
+
nextRowIndex = nextRowIndex >= this.renderedIcons.length ? 0 : nextRowIndex;
|
|
227
|
+
}
|
|
228
|
+
this.focusIcon(nextRowIndex);
|
|
229
|
+
}
|
|
230
|
+
focusPreviousRow() {
|
|
231
|
+
let previousRowIndex = this.focusedItemIndex - this.numberOfElementsPerRow;
|
|
232
|
+
if (previousRowIndex < 0) {
|
|
233
|
+
const numberOfRows = Math.floor(this.renderedIcons.length / this.numberOfElementsPerRow);
|
|
234
|
+
previousRowIndex = this.focusedItemIndex + (this.numberOfElementsPerRow * numberOfRows) - 1;
|
|
235
|
+
previousRowIndex = previousRowIndex < 0
|
|
236
|
+
? this.renderedIcons.length - 1
|
|
237
|
+
: previousRowIndex >= this.renderedIcons.length
|
|
238
|
+
? previousRowIndex - this.numberOfElementsPerRow
|
|
239
|
+
: previousRowIndex;
|
|
240
|
+
}
|
|
241
|
+
this.focusIcon(previousRowIndex);
|
|
242
|
+
}
|
|
243
|
+
getFocusedIcon() {
|
|
244
|
+
return this.renderedIcons[this.focusedItemIndex].icon;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export { IconSelectBox };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { BroadcastDataChannel } from 'vscode/vscode/vs/base/browser/broadcast';
|
|
3
|
+
import { revive } from 'monaco-editor/esm/vs/base/common/marshalling.js';
|
|
4
|
+
import { IEnvironmentService } from 'monaco-editor/esm/vs/platform/environment/common/environment.js';
|
|
5
|
+
import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
6
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
7
|
+
import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
|
|
8
|
+
import { UserDataProfilesService, reviveProfile } from 'monaco-editor/esm/vs/platform/userDataProfile/common/userDataProfile.js';
|
|
9
|
+
|
|
10
|
+
let BrowserUserDataProfilesService = class BrowserUserDataProfilesService extends UserDataProfilesService {
|
|
11
|
+
constructor(environmentService, fileService, uriIdentityService, logService) {
|
|
12
|
+
super(environmentService, fileService, uriIdentityService, logService);
|
|
13
|
+
this.changesBroadcastChannel = this._register(( new BroadcastDataChannel(`${UserDataProfilesService.PROFILES_KEY}.changes`)));
|
|
14
|
+
this._register(this.changesBroadcastChannel.onDidReceiveData(changes => {
|
|
15
|
+
try {
|
|
16
|
+
this._profilesObject = undefined;
|
|
17
|
+
const added = ( changes.added.map(p => reviveProfile(p, this.profilesHome.scheme)));
|
|
18
|
+
const removed = ( changes.removed.map(p => reviveProfile(p, this.profilesHome.scheme)));
|
|
19
|
+
const updated = ( changes.updated.map(p => reviveProfile(p, this.profilesHome.scheme)));
|
|
20
|
+
this.updateTransientProfiles(added.filter(a => a.isTransient), removed.filter(a => a.isTransient), updated.filter(a => a.isTransient));
|
|
21
|
+
this._onDidChangeProfiles.fire({
|
|
22
|
+
added,
|
|
23
|
+
removed,
|
|
24
|
+
updated,
|
|
25
|
+
all: this.profiles
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
catch (error) { }
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
updateTransientProfiles(added, removed, updated) {
|
|
32
|
+
if (added.length) {
|
|
33
|
+
this.transientProfilesObject.profiles.push(...added);
|
|
34
|
+
}
|
|
35
|
+
if (removed.length || updated.length) {
|
|
36
|
+
const allTransientProfiles = this.transientProfilesObject.profiles;
|
|
37
|
+
this.transientProfilesObject.profiles = [];
|
|
38
|
+
for (const profile of allTransientProfiles) {
|
|
39
|
+
if (( removed.some(p => profile.id === p.id))) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
this.transientProfilesObject.profiles.push(updated.find(p => profile.id === p.id) ?? profile);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
getStoredProfiles() {
|
|
47
|
+
try {
|
|
48
|
+
const value = localStorage.getItem(UserDataProfilesService.PROFILES_KEY);
|
|
49
|
+
if (value) {
|
|
50
|
+
return revive(JSON.parse(value));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
this.logService.error(error);
|
|
55
|
+
}
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
triggerProfilesChanges(added, removed, updated) {
|
|
59
|
+
super.triggerProfilesChanges(added, removed, updated);
|
|
60
|
+
this.changesBroadcastChannel.postData({ added, removed, updated });
|
|
61
|
+
}
|
|
62
|
+
saveStoredProfiles(storedProfiles) {
|
|
63
|
+
localStorage.setItem(UserDataProfilesService.PROFILES_KEY, JSON.stringify(storedProfiles));
|
|
64
|
+
}
|
|
65
|
+
getStoredProfileAssociations() {
|
|
66
|
+
const migrateKey = 'profileAssociationsMigration';
|
|
67
|
+
try {
|
|
68
|
+
const value = localStorage.getItem(UserDataProfilesService.PROFILE_ASSOCIATIONS_KEY);
|
|
69
|
+
if (value) {
|
|
70
|
+
let associations = JSON.parse(value);
|
|
71
|
+
if (!localStorage.getItem(migrateKey)) {
|
|
72
|
+
associations = this.migrateStoredProfileAssociations(associations);
|
|
73
|
+
this.saveStoredProfileAssociations(associations);
|
|
74
|
+
localStorage.setItem(migrateKey, 'true');
|
|
75
|
+
}
|
|
76
|
+
return associations;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
this.logService.error(error);
|
|
81
|
+
}
|
|
82
|
+
return {};
|
|
83
|
+
}
|
|
84
|
+
saveStoredProfileAssociations(storedProfileAssociations) {
|
|
85
|
+
localStorage.setItem(UserDataProfilesService.PROFILE_ASSOCIATIONS_KEY, JSON.stringify(storedProfileAssociations));
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
BrowserUserDataProfilesService = ( __decorate([
|
|
89
|
+
( __param(0, IEnvironmentService)),
|
|
90
|
+
( __param(1, IFileService)),
|
|
91
|
+
( __param(2, IUriIdentityService)),
|
|
92
|
+
( __param(3, ILogService))
|
|
93
|
+
], BrowserUserDataProfilesService));
|
|
94
|
+
|
|
95
|
+
export { BrowserUserDataProfilesService };
|