@codingame/monaco-vscode-extension-gallery-service-override 1.85.0 → 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/extensionGallery.js +1 -1
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.contribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.js +1 -1
- package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.js +1 -1
- package/vscode/src/vs/platform/extensionManagement/common/extensionEnablementService.js +0 -142
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.js +0 -43
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsUtils.js +0 -104
- package/vscode/src/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer.js +0 -207
package/extensionGallery.js
CHANGED
|
@@ -2,7 +2,7 @@ import { __decorate, __param } from './external/tslib/tslib.es6.js';
|
|
|
2
2
|
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
3
3
|
import { IExtensionGalleryService, IGlobalExtensionEnablementService, IExtensionManagementService, IExtensionTipsService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
4
4
|
import { ExtensionGalleryService } from './vscode/src/vs/platform/extensionManagement/common/extensionGalleryService.js';
|
|
5
|
-
import { GlobalExtensionEnablementService } from '
|
|
5
|
+
import { GlobalExtensionEnablementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionEnablementService';
|
|
6
6
|
import { IExtensionsWorkbenchService } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions';
|
|
7
7
|
import { ExtensionsWorkbenchService } from './vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.js';
|
|
8
8
|
import { IExtensionManagementServerService, IWebExtensionsScannerService, IWorkbenchExtensionEnablementService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionManagement';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-extension-gallery-service-override",
|
|
3
|
-
"version": "1.85.
|
|
3
|
+
"version": "1.85.2",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@1.85.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.85.2",
|
|
22
22
|
"monaco-editor": "0.45.0",
|
|
23
23
|
"vscode-semver": "npm:semver@=5.5.0"
|
|
24
24
|
}
|
|
@@ -50,7 +50,7 @@ import { Delegate } from './extensionsList.js';
|
|
|
50
50
|
import { ExtensionsTree, ExtensionData, ExtensionsGridView, getExtensions } from './extensionsViewer.js';
|
|
51
51
|
import { RemoteBadgeWidget, VerifiedPublisherWidget, InstallCountWidget, RatingsWidget, SponsorWidget, ExtensionStatusWidget, ExtensionWidget, ExtensionRecommendationWidget, onClick } from './extensionsWidgets.js';
|
|
52
52
|
import { ExtensionContainers, VIEWLET_ID, IExtensionsWorkbenchService } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions';
|
|
53
|
-
import { renderMarkdownDocument, DEFAULT_MARKDOWN_STYLES } from '
|
|
53
|
+
import { renderMarkdownDocument, DEFAULT_MARKDOWN_STYLES } from 'vscode/vscode/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer';
|
|
54
54
|
import { ShowCurrentReleaseNotesActionId } from '../../update/common/update.js';
|
|
55
55
|
import { KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED, IWebviewService } from 'vscode/vscode/vs/workbench/contrib/webview/browser/webview';
|
|
56
56
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
@@ -9,7 +9,7 @@ import { Extensions as Extensions$3 } from 'vscode/vscode/vs/workbench/common/co
|
|
|
9
9
|
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
10
10
|
import { VIEWLET_ID, IExtensionsWorkbenchService, CONTEXT_HAS_GALLERY, AutoUpdateConfigurationKey, HasOutdatedExtensionsContext, OUTDATED_EXTENSIONS_VIEW_ID, SELECT_INSTALL_VSIX_EXTENSION_COMMAND_ID, INSTALL_EXTENSION_FROM_VSIX_COMMAND_ID, extensionsSearchActionsMenu, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID, WORKSPACE_RECOMMENDATIONS_VIEW_ID, THEME_ACTIONS_GROUP, INSTALL_ACTIONS_GROUP, UPDATE_ACTIONS_GROUP, TOGGLE_IGNORE_EXTENSION_ACTION_ID } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions';
|
|
11
11
|
import { SearchExtensionsAction, PromptExtensionInstallFailureAction, ConfigureWorkspaceFolderRecommendedExtensionsAction, InstallSpecificVersionOfExtensionAction, ReinstallAction, SetColorThemeAction, SetFileIconThemeAction, SetProductIconThemeAction, ToggleAutoUpdateForExtensionAction, ToggleAutoUpdatesForPublisherAction, SwitchToPreReleaseVersionAction, SwitchToReleasedVersionAction, ClearLanguageAction, ConfigureWorkspaceRecommendedExtensionsAction } from 'vscode/vscode/vs/workbench/contrib/extensions/browser/extensionsActions';
|
|
12
|
-
import { ExtensionsInput } from '
|
|
12
|
+
import { ExtensionsInput } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensionsInput';
|
|
13
13
|
import { ExtensionEditor } from './extensionEditor.js';
|
|
14
14
|
import { ExtensionsViewPaneContainer, StatusUpdater, MaliciousExtensionChecker, ExtensionsViewletViewsContribution, DefaultViewsContext, SearchHasTextContext } from './extensionsViewlet.js';
|
|
15
15
|
import { Extensions as Extensions$2 } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
|
|
@@ -17,7 +17,7 @@ import * as JSONContributionRegistry from 'monaco-editor/esm/vs/platform/jsonsch
|
|
|
17
17
|
import { ExtensionsConfigurationSchemaId, ExtensionsConfigurationSchema } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensionsFileTemplate';
|
|
18
18
|
import { CommandsRegistry, ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
19
19
|
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
20
|
-
import { KeymapExtensions } from '
|
|
20
|
+
import { KeymapExtensions } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensionsUtils';
|
|
21
21
|
import { areSameExtensions, getIdAndVersion } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
22
22
|
import { EditorPaneDescriptor } from 'vscode/vscode/vs/workbench/browser/editor';
|
|
23
23
|
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
@@ -15,7 +15,7 @@ import { VIEWLET_ID, CONTEXT_HAS_GALLERY, OUTDATED_EXTENSIONS_VIEW_ID, WORKSPACE
|
|
|
15
15
|
import { InstallLocalExtensionsInRemoteAction, InstallRemoteExtensionsInLocalAction } from 'vscode/vscode/vs/workbench/contrib/extensions/browser/extensionsActions';
|
|
16
16
|
import { IExtensionManagementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
17
17
|
import { IExtensionManagementServerService, IWorkbenchExtensionEnablementService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionManagement';
|
|
18
|
-
import { ExtensionsInput } from '
|
|
18
|
+
import { ExtensionsInput } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensionsInput';
|
|
19
19
|
import { ServerInstalledExtensionsView, DefaultPopularExtensionsView, DefaultRecommendedExtensionsView, EnabledExtensionsView, DisabledExtensionsView, SearchMarketplaceExtensionsView, ExtensionsListView, RecentlyUpdatedExtensionsView, OutdatedExtensionsView, WorkspaceRecommendedExtensionsView, RecommendedExtensionsView, BuiltInFeatureExtensionsView, BuiltInThemesExtensionsView, BuiltInProgrammingLanguageExtensionsView, UntrustedWorkspaceUnsupportedExtensionsView, UntrustedWorkspacePartiallySupportedExtensionsView, VirtualWorkspaceUnsupportedExtensionsView, VirtualWorkspacePartiallySupportedExtensionsView, DeprecatedExtensionsView } from './extensionsViews.js';
|
|
20
20
|
import { IProgressService } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
21
21
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
@@ -18,7 +18,7 @@ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
|
18
18
|
import { HasOutdatedExtensionsContext, AutoUpdateConfigurationKey, AutoCheckUpdatesConfigurationKey } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions';
|
|
19
19
|
import { SIDE_GROUP, ACTIVE_GROUP, IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
20
20
|
import { IURLService } from 'vscode/vscode/vs/platform/url/common/url';
|
|
21
|
-
import { ExtensionsInput } from '
|
|
21
|
+
import { ExtensionsInput } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensionsInput';
|
|
22
22
|
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
23
23
|
import { IProgressService } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
24
24
|
import { Severity, INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.js
CHANGED
|
@@ -10,7 +10,7 @@ import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/st
|
|
|
10
10
|
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
11
11
|
import { isLanguagePackExtension, isAuthenticationProviderExtension, isResolverExtension } from 'monaco-editor/esm/vs/platform/extensions/common/extensions.js';
|
|
12
12
|
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
13
|
-
import { StorageManager } from '
|
|
13
|
+
import { StorageManager } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionEnablementService';
|
|
14
14
|
import { webWorkerExtHostConfig } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
15
15
|
import { IUserDataSyncAccountService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSyncAccount';
|
|
16
16
|
import { IUserDataSyncEnablementService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
3
|
-
import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
4
|
-
import { isUndefinedOrNull } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
5
|
-
import { DISABLED_EXTENSIONS_STORAGE_PATH, IExtensionManagementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
6
|
-
import { areSameExtensions } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
7
|
-
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
8
|
-
|
|
9
|
-
let GlobalExtensionEnablementService = class GlobalExtensionEnablementService extends Disposable {
|
|
10
|
-
constructor(storageService, extensionManagementService) {
|
|
11
|
-
super();
|
|
12
|
-
this._onDidChangeEnablement = ( new Emitter());
|
|
13
|
-
this.onDidChangeEnablement = this._onDidChangeEnablement.event;
|
|
14
|
-
this.storageManger = this._register(( new StorageManager(storageService)));
|
|
15
|
-
this._register(this.storageManger.onDidChange(extensions => this._onDidChangeEnablement.fire({ extensions, source: 'storage' })));
|
|
16
|
-
this._register(extensionManagementService.onDidInstallExtensions(e => e.forEach(({ local, operation }) => {
|
|
17
|
-
if (local && operation === 4 ) {
|
|
18
|
-
this._removeFromDisabledExtensions(local.identifier);
|
|
19
|
-
}
|
|
20
|
-
})));
|
|
21
|
-
}
|
|
22
|
-
async enableExtension(extension, source) {
|
|
23
|
-
if (this._removeFromDisabledExtensions(extension)) {
|
|
24
|
-
this._onDidChangeEnablement.fire({ extensions: [extension], source });
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
async disableExtension(extension, source) {
|
|
30
|
-
if (this._addToDisabledExtensions(extension)) {
|
|
31
|
-
this._onDidChangeEnablement.fire({ extensions: [extension], source });
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
getDisabledExtensions() {
|
|
37
|
-
return this._getExtensions(DISABLED_EXTENSIONS_STORAGE_PATH);
|
|
38
|
-
}
|
|
39
|
-
async getDisabledExtensionsAsync() {
|
|
40
|
-
return this.getDisabledExtensions();
|
|
41
|
-
}
|
|
42
|
-
_addToDisabledExtensions(identifier) {
|
|
43
|
-
const disabledExtensions = this.getDisabledExtensions();
|
|
44
|
-
if (disabledExtensions.every(e => !areSameExtensions(e, identifier))) {
|
|
45
|
-
disabledExtensions.push(identifier);
|
|
46
|
-
this._setDisabledExtensions(disabledExtensions);
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
_removeFromDisabledExtensions(identifier) {
|
|
52
|
-
const disabledExtensions = this.getDisabledExtensions();
|
|
53
|
-
for (let index = 0; index < disabledExtensions.length; index++) {
|
|
54
|
-
const disabledExtension = disabledExtensions[index];
|
|
55
|
-
if (areSameExtensions(disabledExtension, identifier)) {
|
|
56
|
-
disabledExtensions.splice(index, 1);
|
|
57
|
-
this._setDisabledExtensions(disabledExtensions);
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
_setDisabledExtensions(disabledExtensions) {
|
|
64
|
-
this._setExtensions(DISABLED_EXTENSIONS_STORAGE_PATH, disabledExtensions);
|
|
65
|
-
}
|
|
66
|
-
_getExtensions(storageId) {
|
|
67
|
-
return this.storageManger.get(storageId, 0 );
|
|
68
|
-
}
|
|
69
|
-
_setExtensions(storageId, extensions) {
|
|
70
|
-
this.storageManger.set(storageId, extensions, 0 );
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
GlobalExtensionEnablementService = ( __decorate([
|
|
74
|
-
( __param(0, IStorageService)),
|
|
75
|
-
( __param(1, IExtensionManagementService))
|
|
76
|
-
], GlobalExtensionEnablementService));
|
|
77
|
-
class StorageManager extends Disposable {
|
|
78
|
-
constructor(storageService) {
|
|
79
|
-
super();
|
|
80
|
-
this.storageService = storageService;
|
|
81
|
-
this.storage = Object.create(null);
|
|
82
|
-
this._onDidChange = this._register(( new Emitter()));
|
|
83
|
-
this.onDidChange = this._onDidChange.event;
|
|
84
|
-
this._register(storageService.onDidChangeValue(0 , undefined, this._register(( new DisposableStore())))(e => this.onDidStorageChange(e)));
|
|
85
|
-
}
|
|
86
|
-
get(key, scope) {
|
|
87
|
-
let value;
|
|
88
|
-
if (scope === 0 ) {
|
|
89
|
-
if (isUndefinedOrNull(this.storage[key])) {
|
|
90
|
-
this.storage[key] = this._get(key, scope);
|
|
91
|
-
}
|
|
92
|
-
value = this.storage[key];
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
value = this._get(key, scope);
|
|
96
|
-
}
|
|
97
|
-
return JSON.parse(value);
|
|
98
|
-
}
|
|
99
|
-
set(key, value, scope) {
|
|
100
|
-
const newValue = JSON.stringify(( value.map(({ id, uuid }) => ({ id, uuid }))));
|
|
101
|
-
const oldValue = this._get(key, scope);
|
|
102
|
-
if (oldValue !== newValue) {
|
|
103
|
-
if (scope === 0 ) {
|
|
104
|
-
if (value.length) {
|
|
105
|
-
this.storage[key] = newValue;
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
delete this.storage[key];
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
this._set(key, value.length ? newValue : undefined, scope);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
onDidStorageChange(storageChangeEvent) {
|
|
115
|
-
if (!isUndefinedOrNull(this.storage[storageChangeEvent.key])) {
|
|
116
|
-
const newValue = this._get(storageChangeEvent.key, storageChangeEvent.scope);
|
|
117
|
-
if (newValue !== this.storage[storageChangeEvent.key]) {
|
|
118
|
-
const oldValues = this.get(storageChangeEvent.key, storageChangeEvent.scope);
|
|
119
|
-
delete this.storage[storageChangeEvent.key];
|
|
120
|
-
const newValues = this.get(storageChangeEvent.key, storageChangeEvent.scope);
|
|
121
|
-
const added = oldValues.filter(oldValue => !( newValues.some(newValue => areSameExtensions(oldValue, newValue))));
|
|
122
|
-
const removed = newValues.filter(newValue => !( oldValues.some(oldValue => areSameExtensions(oldValue, newValue))));
|
|
123
|
-
if (added.length || removed.length) {
|
|
124
|
-
this._onDidChange.fire([...added, ...removed]);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
_get(key, scope) {
|
|
130
|
-
return this.storageService.get(key, scope, '[]');
|
|
131
|
-
}
|
|
132
|
-
_set(key, value, scope) {
|
|
133
|
-
if (value) {
|
|
134
|
-
this.storageService.store(key, value, scope, 1 );
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
this.storageService.remove(key, scope);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export { GlobalExtensionEnablementService, StorageManager };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
2
|
-
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
3
|
-
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
4
|
-
import { EditorInput } from 'vscode/vscode/vs/workbench/common/editor/editorInput';
|
|
5
|
-
import { areSameExtensions } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
6
|
-
import { join } from 'monaco-editor/esm/vs/base/common/path.js';
|
|
7
|
-
|
|
8
|
-
class ExtensionsInput extends EditorInput {
|
|
9
|
-
static { this.ID = 'workbench.extensions.input2'; }
|
|
10
|
-
get typeId() {
|
|
11
|
-
return ExtensionsInput.ID;
|
|
12
|
-
}
|
|
13
|
-
get capabilities() {
|
|
14
|
-
return 2 | 8 | 1024 ;
|
|
15
|
-
}
|
|
16
|
-
get resource() {
|
|
17
|
-
return ( URI.from({
|
|
18
|
-
scheme: Schemas.extension,
|
|
19
|
-
path: join(this._extension.identifier.id, 'extension')
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
constructor(_extension) {
|
|
23
|
-
super();
|
|
24
|
-
this._extension = _extension;
|
|
25
|
-
}
|
|
26
|
-
get extension() { return this._extension; }
|
|
27
|
-
getName() {
|
|
28
|
-
return ( localizeWithPath(
|
|
29
|
-
'vs/workbench/contrib/extensions/common/extensionsInput',
|
|
30
|
-
'extensionsInputName',
|
|
31
|
-
"Extension: {0}",
|
|
32
|
-
this._extension.displayName
|
|
33
|
-
));
|
|
34
|
-
}
|
|
35
|
-
matches(other) {
|
|
36
|
-
if (super.matches(other)) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
return other instanceof ExtensionsInput && areSameExtensions(this._extension.identifier, other._extension.identifier);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { ExtensionsInput };
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
3
|
-
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
4
|
-
import { onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
5
|
-
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
6
|
-
import { IExtensionManagementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
7
|
-
import { IWorkbenchExtensionEnablementService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionManagement';
|
|
8
|
-
import { IExtensionRecommendationsService } from 'vscode/vscode/vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
|
|
9
|
-
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
10
|
-
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
11
|
-
import { areSameExtensions } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
12
|
-
import { Severity, INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
13
|
-
|
|
14
|
-
let KeymapExtensions = class KeymapExtensions extends Disposable {
|
|
15
|
-
constructor(instantiationService, extensionEnablementService, tipsService, lifecycleService, notificationService) {
|
|
16
|
-
super();
|
|
17
|
-
this.instantiationService = instantiationService;
|
|
18
|
-
this.extensionEnablementService = extensionEnablementService;
|
|
19
|
-
this.tipsService = tipsService;
|
|
20
|
-
this.notificationService = notificationService;
|
|
21
|
-
this._register(lifecycleService.onDidShutdown(() => this.dispose()));
|
|
22
|
-
this._register(instantiationService.invokeFunction(onExtensionChanged)((identifiers => {
|
|
23
|
-
Promise.all(( identifiers.map(identifier => this.checkForOtherKeymaps(identifier))))
|
|
24
|
-
.then(undefined, onUnexpectedError);
|
|
25
|
-
})));
|
|
26
|
-
}
|
|
27
|
-
checkForOtherKeymaps(extensionIdentifier) {
|
|
28
|
-
return this.instantiationService.invokeFunction(getInstalledExtensions).then(extensions => {
|
|
29
|
-
const keymaps = extensions.filter(extension => isKeymapExtension(this.tipsService, extension));
|
|
30
|
-
const extension = keymaps.find(extension => areSameExtensions(extension.identifier, extensionIdentifier));
|
|
31
|
-
if (extension && extension.globallyEnabled) {
|
|
32
|
-
const otherKeymaps = keymaps.filter(extension => !areSameExtensions(extension.identifier, extensionIdentifier) && extension.globallyEnabled);
|
|
33
|
-
if (otherKeymaps.length) {
|
|
34
|
-
return this.promptForDisablingOtherKeymaps(extension, otherKeymaps);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return undefined;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
promptForDisablingOtherKeymaps(newKeymap, oldKeymaps) {
|
|
41
|
-
const onPrompt = (confirmed) => {
|
|
42
|
-
if (confirmed) {
|
|
43
|
-
this.extensionEnablementService.setEnablement(( oldKeymaps.map(keymap => keymap.local)), 6 );
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
this.notificationService.prompt(Severity.Info, ( localizeWithPath(
|
|
47
|
-
'vs/workbench/contrib/extensions/common/extensionsUtils',
|
|
48
|
-
'disableOtherKeymapsConfirmation',
|
|
49
|
-
"Disable other keymaps ({0}) to avoid conflicts between keybindings?",
|
|
50
|
-
( oldKeymaps.map(k => `'${k.local.manifest.displayName}'`)).join(', ')
|
|
51
|
-
)), [{
|
|
52
|
-
label: ( localizeWithPath('vs/workbench/contrib/extensions/common/extensionsUtils', 'yes', "Yes")),
|
|
53
|
-
run: () => onPrompt(true)
|
|
54
|
-
}, {
|
|
55
|
-
label: ( localizeWithPath('vs/workbench/contrib/extensions/common/extensionsUtils', 'no', "No")),
|
|
56
|
-
run: () => onPrompt(false)
|
|
57
|
-
}]);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
KeymapExtensions = ( __decorate([
|
|
61
|
-
( __param(0, IInstantiationService)),
|
|
62
|
-
( __param(1, IWorkbenchExtensionEnablementService)),
|
|
63
|
-
( __param(2, IExtensionRecommendationsService)),
|
|
64
|
-
( __param(3, ILifecycleService)),
|
|
65
|
-
( __param(4, INotificationService))
|
|
66
|
-
], KeymapExtensions));
|
|
67
|
-
function onExtensionChanged(accessor) {
|
|
68
|
-
const extensionService = accessor.get(IExtensionManagementService);
|
|
69
|
-
const extensionEnablementService = accessor.get(IWorkbenchExtensionEnablementService);
|
|
70
|
-
const onDidInstallExtensions = Event.chain(extensionService.onDidInstallExtensions, $ => ( $.filter(e => ( e.some(({ operation }) => operation === 2 )))
|
|
71
|
-
.map(e => ( e.map(({ identifier }) => identifier)))));
|
|
72
|
-
return Event.debounce(Event.any(Event.any(onDidInstallExtensions, ( Event.map(extensionService.onDidUninstallExtension, e => [e.identifier]))), ( Event.map(
|
|
73
|
-
extensionEnablementService.onEnablementChanged,
|
|
74
|
-
extensions => ( extensions.map(e => e.identifier))
|
|
75
|
-
))), (result, identifiers) => {
|
|
76
|
-
result = result || [];
|
|
77
|
-
for (const identifier of identifiers) {
|
|
78
|
-
if (( result.some(l => !areSameExtensions(l, identifier)))) {
|
|
79
|
-
result.push(identifier);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return result;
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
async function getInstalledExtensions(accessor) {
|
|
86
|
-
const extensionService = accessor.get(IExtensionManagementService);
|
|
87
|
-
const extensionEnablementService = accessor.get(IWorkbenchExtensionEnablementService);
|
|
88
|
-
const extensions = await extensionService.getInstalled();
|
|
89
|
-
return ( extensions.map(extension => {
|
|
90
|
-
return {
|
|
91
|
-
identifier: extension.identifier,
|
|
92
|
-
local: extension,
|
|
93
|
-
globallyEnabled: extensionEnablementService.isEnabled(extension)
|
|
94
|
-
};
|
|
95
|
-
}));
|
|
96
|
-
}
|
|
97
|
-
function isKeymapExtension(tipsService, extension) {
|
|
98
|
-
const cats = extension.local.manifest.categories;
|
|
99
|
-
return cats && cats.indexOf('Keymaps') !== -1 || ( tipsService.getKeymapRecommendations().some(
|
|
100
|
-
extensionId => areSameExtensions({ id: extensionId }, extension.local.identifier)
|
|
101
|
-
));
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export { KeymapExtensions, getInstalledExtensions };
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { hookDomPurifyHrefAndSrcSanitizer, basicMarkupHtmlTags } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
2
|
-
import * as dompurify from 'monaco-editor/esm/vs/base/browser/dompurify/dompurify.js';
|
|
3
|
-
import { allowedMarkdownAttr } from 'monaco-editor/esm/vs/base/browser/markdownRenderer.js';
|
|
4
|
-
import { marked } from 'monaco-editor/esm/vs/base/common/marked/marked.js';
|
|
5
|
-
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
6
|
-
import { tokenizeToString } from 'monaco-editor/esm/vs/editor/common/languages/textToHtmlTokenizer.js';
|
|
7
|
-
import { escape } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
8
|
-
|
|
9
|
-
const DEFAULT_MARKDOWN_STYLES = `
|
|
10
|
-
body {
|
|
11
|
-
padding: 10px 20px;
|
|
12
|
-
line-height: 22px;
|
|
13
|
-
max-width: 882px;
|
|
14
|
-
margin: 0 auto;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
body *:last-child {
|
|
18
|
-
margin-bottom: 0;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
img {
|
|
22
|
-
max-width: 100%;
|
|
23
|
-
max-height: 100%;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
a {
|
|
27
|
-
text-decoration: none;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
a:hover {
|
|
31
|
-
text-decoration: underline;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
a:focus,
|
|
35
|
-
input:focus,
|
|
36
|
-
select:focus,
|
|
37
|
-
textarea:focus {
|
|
38
|
-
outline: 1px solid -webkit-focus-ring-color;
|
|
39
|
-
outline-offset: -1px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
hr {
|
|
43
|
-
border: 0;
|
|
44
|
-
height: 2px;
|
|
45
|
-
border-bottom: 2px solid;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
h1 {
|
|
49
|
-
padding-bottom: 0.3em;
|
|
50
|
-
line-height: 1.2;
|
|
51
|
-
border-bottom-width: 1px;
|
|
52
|
-
border-bottom-style: solid;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
h1, h2, h3 {
|
|
56
|
-
font-weight: normal;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
table {
|
|
60
|
-
border-collapse: collapse;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
th {
|
|
64
|
-
text-align: left;
|
|
65
|
-
border-bottom: 1px solid;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
th,
|
|
69
|
-
td {
|
|
70
|
-
padding: 5px 10px;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
table > tbody > tr + tr > td {
|
|
74
|
-
border-top-width: 1px;
|
|
75
|
-
border-top-style: solid;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
blockquote {
|
|
79
|
-
margin: 0 7px 0 5px;
|
|
80
|
-
padding: 0 16px 0 10px;
|
|
81
|
-
border-left-width: 5px;
|
|
82
|
-
border-left-style: solid;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
code {
|
|
86
|
-
font-family: "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
pre {
|
|
90
|
-
padding: 16px;
|
|
91
|
-
border-radius: 3px;
|
|
92
|
-
overflow: auto;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
pre code {
|
|
96
|
-
font-family: var(--vscode-editor-font-family);
|
|
97
|
-
font-weight: var(--vscode-editor-font-weight);
|
|
98
|
-
font-size: var(--vscode-editor-font-size);
|
|
99
|
-
line-height: 1.5;
|
|
100
|
-
color: var(--vscode-editor-foreground);
|
|
101
|
-
tab-size: 4;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.monaco-tokenized-source {
|
|
105
|
-
white-space: pre;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/** Theming */
|
|
109
|
-
|
|
110
|
-
.pre {
|
|
111
|
-
background-color: var(--vscode-textCodeBlock-background);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.vscode-high-contrast h1 {
|
|
115
|
-
border-color: rgb(0, 0, 0);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.vscode-light th {
|
|
119
|
-
border-color: rgba(0, 0, 0, 0.69);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.vscode-dark th {
|
|
123
|
-
border-color: rgba(255, 255, 255, 0.69);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.vscode-light h1,
|
|
127
|
-
.vscode-light hr,
|
|
128
|
-
.vscode-light td {
|
|
129
|
-
border-color: rgba(0, 0, 0, 0.18);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.vscode-dark h1,
|
|
133
|
-
.vscode-dark hr,
|
|
134
|
-
.vscode-dark td {
|
|
135
|
-
border-color: rgba(255, 255, 255, 0.18);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
@media (forced-colors: active) and (prefers-color-scheme: light){
|
|
139
|
-
body {
|
|
140
|
-
forced-color-adjust: none;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
@media (forced-colors: active) and (prefers-color-scheme: dark){
|
|
145
|
-
body {
|
|
146
|
-
forced-color-adjust: none;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
`;
|
|
150
|
-
const allowedProtocols = [Schemas.http, Schemas.https, Schemas.command];
|
|
151
|
-
function sanitize(documentContent, allowUnknownProtocols) {
|
|
152
|
-
const hook = hookDomPurifyHrefAndSrcSanitizer(allowedProtocols, true);
|
|
153
|
-
try {
|
|
154
|
-
return dompurify.sanitize(documentContent, {
|
|
155
|
-
...{
|
|
156
|
-
ALLOWED_TAGS: [
|
|
157
|
-
...basicMarkupHtmlTags,
|
|
158
|
-
'checkbox',
|
|
159
|
-
'checklist',
|
|
160
|
-
],
|
|
161
|
-
ALLOWED_ATTR: [
|
|
162
|
-
...allowedMarkdownAttr,
|
|
163
|
-
'data-command', 'name', 'id', 'role', 'tabindex',
|
|
164
|
-
'x-dispatch',
|
|
165
|
-
'required', 'checked', 'placeholder', 'when-checked', 'checked-on',
|
|
166
|
-
],
|
|
167
|
-
},
|
|
168
|
-
...(allowUnknownProtocols ? { ALLOW_UNKNOWN_PROTOCOLS: true } : {}),
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
finally {
|
|
172
|
-
hook.dispose();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
async function renderMarkdownDocument(text, extensionService, languageService, shouldSanitize = true, allowUnknownProtocols = false, token) {
|
|
176
|
-
const highlight = (code, lang, callback) => {
|
|
177
|
-
if (!callback) {
|
|
178
|
-
return code;
|
|
179
|
-
}
|
|
180
|
-
if (typeof lang !== 'string') {
|
|
181
|
-
callback(null, `<code>${escape(code)}</code>`);
|
|
182
|
-
return '';
|
|
183
|
-
}
|
|
184
|
-
extensionService.whenInstalledExtensionsRegistered().then(async () => {
|
|
185
|
-
if (token?.isCancellationRequested) {
|
|
186
|
-
callback(null, '');
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
const languageId = languageService.getLanguageIdByLanguageName(lang);
|
|
190
|
-
const html = await tokenizeToString(languageService, code, languageId);
|
|
191
|
-
callback(null, `<code>${html}</code>`);
|
|
192
|
-
});
|
|
193
|
-
return '';
|
|
194
|
-
};
|
|
195
|
-
return ( new Promise((resolve, reject) => {
|
|
196
|
-
marked(text, { highlight }, (err, value) => err ? reject(err) : resolve(value));
|
|
197
|
-
})).then(raw => {
|
|
198
|
-
if (shouldSanitize) {
|
|
199
|
-
return sanitize(raw, allowUnknownProtocols);
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
return raw;
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export { DEFAULT_MARKDOWN_STYLES, renderMarkdownDocument };
|