@codingame/monaco-vscode-extension-gallery-service-override 1.83.9
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.d.ts +12 -0
- package/extensionGallery.js +76 -0
- 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/package.json +30 -0
- package/vscode/src/vs/platform/extensionManagement/common/abstractExtensionManagementService.js +784 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionEnablementService.js +142 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionGalleryService.js +855 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagementIpc.js +119 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionTipsService.js +57 -0
- package/vscode/src/vs/platform/extensionManagement/common/unsupportedExtensionsMigration.js +58 -0
- package/vscode/src/vs/platform/externalServices/common/marketplace.js +17 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/abstractRuntimeExtensionsEditor.js +492 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/browserRuntimeExtensionsEditor.js +28 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/configBasedRecommendations.js +78 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/deprecatedExtensionsChecker.js +87 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/exeBasedRecommendations.js +60 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEditor.js +1868 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEnablementWorkspaceTrustTransitionParticipant.js +52 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.js +437 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendations.js +17 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationsService.js +221 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.contribution.js +2063 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.web.contribution.js +13 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActivationProgress.js +46 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsCompletionItemsProvider.js +65 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsDependencyChecker.js +98 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsList.js +224 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.js +121 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewer.js +285 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.js +912 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViews.js +1270 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWidgets.js +824 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.js +1730 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/fileBasedRecommendations.js +324 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/keymapRecommendations.js +28 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/languageRecommendations.js +28 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/extension.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionsViewlet.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionsWidgets.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/runtimeExtensionsEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/remoteRecommendations.js +29 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/unsupportedExtensionsMigrationContribution.js +26 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/webRecommendations.js +38 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/workspaceRecommendations.js +88 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionQuery.js +67 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.js +43 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsUtils.js +104 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/reportExtensionIssueAction.js +31 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/runtimeExtensionsInput.js +41 -0
- package/vscode/src/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer.js +207 -0
- package/vscode/src/vs/workbench/contrib/update/common/update.js +3 -0
- package/vscode/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.js +84 -0
- package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.js +634 -0
- package/vscode/src/vs/workbench/services/extensionManagement/browser/webExtensionsScannerService.js +883 -0
- package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementChannelClient.js +109 -0
- package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.js +62 -0
- package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementService.js +633 -0
- package/vscode/src/vs/workbench/services/extensionManagement/common/remoteExtensionManagementService.js +58 -0
- package/vscode/src/vs/workbench/services/extensionManagement/common/webExtensionManagementService.js +269 -0
- package/vscode/src/vs/workbench/services/extensionRecommendations/common/extensionIgnoredRecommendationsService.js +83 -0
- package/vscode/src/vs/workbench/services/remote/common/remoteExtensionsScanner.js +73 -0
|
@@ -0,0 +1,1868 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import './media/extensionEditor.css.js';
|
|
3
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
4
|
+
import * as arrays from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
5
|
+
import { language, OS } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
6
|
+
import { Event, Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
7
|
+
import { Cache } from 'monaco-editor/esm/vs/base/common/cache.js';
|
|
8
|
+
import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
9
|
+
import { getErrorMessage, onUnexpectedError, isCancellationError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
10
|
+
import { MutableDisposable, DisposableStore, toDisposable, Disposable, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
11
|
+
import { append, $, addDisposableListener, setParentFlowTo, join, reset } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
12
|
+
import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
|
|
13
|
+
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
14
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
15
|
+
import { IExtensionRecommendationsService } from 'vscode/vscode/vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
|
|
16
|
+
import { ExtensionIdentifier } from 'monaco-editor/esm/vs/platform/extensions/common/extensions.js';
|
|
17
|
+
import { ExtensionContainers, VIEWLET_ID, IExtensionsWorkbenchService } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions';
|
|
18
|
+
import { RemoteBadgeWidget, VerifiedPublisherWidget, InstallCountWidget, RatingsWidget, SponsorWidget, ExtensionStatusWidget, ExtensionWidget, ExtensionRecommendationWidget, onClick } from './extensionsWidgets.js';
|
|
19
|
+
import { ActionBar } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js';
|
|
20
|
+
import { InstallDropdownAction, ReloadAction, ExtensionStatusLabelAction, ActionWithDropDownAction, UpdateAction, SkipUpdateAction, SetColorThemeAction, SetFileIconThemeAction, SetProductIconThemeAction, SetLanguageAction, ClearLanguageAction, EnableDropDownAction, DisableDropDownAction, RemoteInstallAction, LocalInstallAction, WebInstallAction, InstallingLabelAction, UninstallAction, MigrateDeprecatedExtensionAction, InstallAnotherVersionAction, SwitchToPreReleaseVersionAction, SwitchToReleasedVersionAction, ToggleSyncExtensionAction, ExtensionEditorManageExtensionAction, ExtensionDropDownAction, ExtensionActionWithDropdownActionViewItem, ExtensionStatusAction } from 'vscode/vscode/vs/workbench/contrib/extensions/browser/extensionsActions';
|
|
21
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
22
|
+
import { DomScrollableElement } from 'monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js';
|
|
23
|
+
import { matchesScheme, IOpenerService } from 'monaco-editor/esm/vs/platform/opener/common/opener.js';
|
|
24
|
+
import { registerThemingParticipant, IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
25
|
+
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
26
|
+
import { KeybindingLabel } from 'monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.js';
|
|
27
|
+
import { RawContextKey, ContextKeyExpr, IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
28
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
29
|
+
import { Color } from 'monaco-editor/esm/vs/base/common/color.js';
|
|
30
|
+
import { Severity, INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
31
|
+
import { CancellationToken, CancellationTokenSource } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
32
|
+
import { ExtensionsTree, ExtensionData, ExtensionsGridView, getExtensions } from './extensionsViewer.js';
|
|
33
|
+
import { ShowCurrentReleaseNotesActionId } from '../../update/common/update.js';
|
|
34
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
35
|
+
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
36
|
+
import { getDefaultValue } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
|
|
37
|
+
import { isUndefined } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
38
|
+
import { KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED, IWebviewService } from 'vscode/vscode/vs/workbench/contrib/webview/browser/webview';
|
|
39
|
+
import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
|
|
40
|
+
import { platform } from 'monaco-editor/esm/vs/base/common/process.js';
|
|
41
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
42
|
+
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
43
|
+
import { renderMarkdownDocument, DEFAULT_MARKDOWN_STYLES } from '../../markdown/browser/markdownDocumentRenderer.js';
|
|
44
|
+
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
|
|
45
|
+
import { TokenizationRegistry } from 'monaco-editor/esm/vs/editor/common/languages.js';
|
|
46
|
+
import { generateTokensCSSForColorMap } from 'monaco-editor/esm/vs/editor/common/languages/supports/tokenization.js';
|
|
47
|
+
import { editorBackground, textLinkForeground, textLinkActiveForeground, buttonHoverBackground, buttonForeground } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
48
|
+
import { registerAction2, Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
49
|
+
import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
|
|
50
|
+
import { EditorContextKeys } from 'monaco-editor/esm/vs/editor/common/editorContextKeys.js';
|
|
51
|
+
import { Delegate } from './extensionsList.js';
|
|
52
|
+
import { renderMarkdown } from 'monaco-editor/esm/vs/base/browser/markdownRenderer.js';
|
|
53
|
+
import { areSameExtensions } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
54
|
+
import { errorIcon, warningIcon, infoIcon, preReleaseIcon } from 'vscode/vscode/vs/workbench/contrib/extensions/browser/extensionsIcons';
|
|
55
|
+
import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/panecomposite/browser/panecomposite';
|
|
56
|
+
import { IExtensionGalleryService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
57
|
+
import { valid } from 'vscode-semver';
|
|
58
|
+
import { defaultKeybindingLabelStyles } from 'monaco-editor/esm/vs/platform/theme/browser/defaultStyles.js';
|
|
59
|
+
|
|
60
|
+
var ExtensionEditor_1;
|
|
61
|
+
class NavBar extends Disposable {
|
|
62
|
+
get onChange() { return this._onChange.event; }
|
|
63
|
+
get currentId() { return this._currentId; }
|
|
64
|
+
constructor(container) {
|
|
65
|
+
super();
|
|
66
|
+
this._onChange = this._register(( new Emitter()));
|
|
67
|
+
this._currentId = null;
|
|
68
|
+
const element = append(container, $('.navbar'));
|
|
69
|
+
this.actions = [];
|
|
70
|
+
this.actionbar = this._register(( new ActionBar(element, { animated: false })));
|
|
71
|
+
}
|
|
72
|
+
push(id, label, tooltip) {
|
|
73
|
+
const action = ( new Action(id, label, undefined, true, () => this.update(id, true)));
|
|
74
|
+
action.tooltip = tooltip;
|
|
75
|
+
this.actions.push(action);
|
|
76
|
+
this.actionbar.push(action);
|
|
77
|
+
if (this.actions.length === 1) {
|
|
78
|
+
this.update(id);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
clear() {
|
|
82
|
+
this.actions = dispose(this.actions);
|
|
83
|
+
this.actionbar.clear();
|
|
84
|
+
}
|
|
85
|
+
switch(id) {
|
|
86
|
+
const action = this.actions.find(action => action.id === id);
|
|
87
|
+
if (action) {
|
|
88
|
+
action.run();
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
update(id, focus) {
|
|
94
|
+
this._currentId = id;
|
|
95
|
+
this._onChange.fire({ id, focus: !!focus });
|
|
96
|
+
this.actions.forEach(a => a.checked = a.id === id);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const CONTEXT_SHOW_PRE_RELEASE_VERSION = ( new RawContextKey('showPreReleaseVersion', false));
|
|
100
|
+
class ExtensionWithDifferentGalleryVersionWidget extends ExtensionWidget {
|
|
101
|
+
constructor() {
|
|
102
|
+
super(...arguments);
|
|
103
|
+
this._gallery = null;
|
|
104
|
+
}
|
|
105
|
+
get gallery() { return this._gallery; }
|
|
106
|
+
set gallery(gallery) {
|
|
107
|
+
if (this.extension && gallery && !areSameExtensions(this.extension.identifier, gallery.identifier)) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
this._gallery = gallery;
|
|
111
|
+
this.update();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
class VersionWidget extends ExtensionWithDifferentGalleryVersionWidget {
|
|
115
|
+
constructor(container) {
|
|
116
|
+
super();
|
|
117
|
+
this.element = append(container, $('code.version', { title: ( localizeWithPath(
|
|
118
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
119
|
+
'extension version',
|
|
120
|
+
"Extension Version"
|
|
121
|
+
)) }));
|
|
122
|
+
this.render();
|
|
123
|
+
}
|
|
124
|
+
render() {
|
|
125
|
+
if (!this.extension || !valid(this.extension.version)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.element.textContent = `v${this.gallery?.version ?? this.extension.version}`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
class PreReleaseTextWidget extends ExtensionWithDifferentGalleryVersionWidget {
|
|
132
|
+
constructor(container) {
|
|
133
|
+
super();
|
|
134
|
+
this.element = append(container, $('span.pre-release'));
|
|
135
|
+
append(this.element, $('span' + ThemeIcon.asCSSSelector(preReleaseIcon)));
|
|
136
|
+
const textElement = append(this.element, $('span.pre-release-text'));
|
|
137
|
+
textElement.textContent = ( localizeWithPath(
|
|
138
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
139
|
+
'preRelease',
|
|
140
|
+
"Pre-Release"
|
|
141
|
+
));
|
|
142
|
+
this.render();
|
|
143
|
+
}
|
|
144
|
+
render() {
|
|
145
|
+
this.element.style.display = this.isPreReleaseVersion() ? 'inherit' : 'none';
|
|
146
|
+
}
|
|
147
|
+
isPreReleaseVersion() {
|
|
148
|
+
if (!this.extension) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
if (this.gallery) {
|
|
152
|
+
return this.gallery.properties.isPreReleaseVersion;
|
|
153
|
+
}
|
|
154
|
+
return !!(this.extension.state === 1 ? this.extension.local?.isPreReleaseVersion : this.extension.gallery?.properties.isPreReleaseVersion);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
let ExtensionEditor = class ExtensionEditor extends EditorPane {
|
|
158
|
+
static { ExtensionEditor_1 = this; }
|
|
159
|
+
static { this.ID = 'workbench.editor.extension'; }
|
|
160
|
+
constructor(telemetryService, instantiationService, paneCompositeService, extensionsWorkbenchService, extensionGalleryService, themeService, keybindingService, notificationService, openerService, extensionRecommendationsService, storageService, extensionService, webviewService, languageService, contextMenuService, contextKeyService) {
|
|
161
|
+
super(ExtensionEditor_1.ID, telemetryService, themeService, storageService);
|
|
162
|
+
this.instantiationService = instantiationService;
|
|
163
|
+
this.paneCompositeService = paneCompositeService;
|
|
164
|
+
this.extensionsWorkbenchService = extensionsWorkbenchService;
|
|
165
|
+
this.extensionGalleryService = extensionGalleryService;
|
|
166
|
+
this.keybindingService = keybindingService;
|
|
167
|
+
this.notificationService = notificationService;
|
|
168
|
+
this.openerService = openerService;
|
|
169
|
+
this.extensionRecommendationsService = extensionRecommendationsService;
|
|
170
|
+
this.extensionService = extensionService;
|
|
171
|
+
this.webviewService = webviewService;
|
|
172
|
+
this.languageService = languageService;
|
|
173
|
+
this.contextMenuService = contextMenuService;
|
|
174
|
+
this.contextKeyService = contextKeyService;
|
|
175
|
+
this._scopedContextKeyService = this._register(( new MutableDisposable()));
|
|
176
|
+
this.initialScrollProgress = ( new Map());
|
|
177
|
+
this.currentIdentifier = '';
|
|
178
|
+
this.layoutParticipants = [];
|
|
179
|
+
this.contentDisposables = this._register(( new DisposableStore()));
|
|
180
|
+
this.transientDisposables = this._register(( new DisposableStore()));
|
|
181
|
+
this.activeElement = null;
|
|
182
|
+
this.extensionReadme = null;
|
|
183
|
+
this.extensionChangelog = null;
|
|
184
|
+
this.extensionManifest = null;
|
|
185
|
+
}
|
|
186
|
+
get scopedContextKeyService() {
|
|
187
|
+
return this._scopedContextKeyService.value;
|
|
188
|
+
}
|
|
189
|
+
createEditor(parent) {
|
|
190
|
+
const root = append(parent, $('.extension-editor'));
|
|
191
|
+
this._scopedContextKeyService.value = this.contextKeyService.createScoped(root);
|
|
192
|
+
this._scopedContextKeyService.value.createKey('inExtensionEditor', true);
|
|
193
|
+
this.showPreReleaseVersionContextKey = CONTEXT_SHOW_PRE_RELEASE_VERSION.bindTo(this._scopedContextKeyService.value);
|
|
194
|
+
root.tabIndex = 0;
|
|
195
|
+
root.style.outline = 'none';
|
|
196
|
+
root.setAttribute('role', 'document');
|
|
197
|
+
const header = append(root, $('.header'));
|
|
198
|
+
const iconContainer = append(header, $('.icon-container'));
|
|
199
|
+
const icon = append(iconContainer, $('img.icon', { draggable: false, alt: '' }));
|
|
200
|
+
const remoteBadge = this.instantiationService.createInstance(RemoteBadgeWidget, iconContainer, true);
|
|
201
|
+
const details = append(header, $('.details'));
|
|
202
|
+
const title = append(details, $('.title'));
|
|
203
|
+
const name = append(title, $('span.name.clickable', { title: ( localizeWithPath(
|
|
204
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
205
|
+
'name',
|
|
206
|
+
"Extension name"
|
|
207
|
+
)), role: 'heading', tabIndex: 0 }));
|
|
208
|
+
const versionWidget = ( new VersionWidget(title));
|
|
209
|
+
const preReleaseWidget = ( new PreReleaseTextWidget(title));
|
|
210
|
+
const preview = append(title, $('span.preview', { title: ( localizeWithPath(
|
|
211
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
212
|
+
'preview',
|
|
213
|
+
"Preview"
|
|
214
|
+
)) }));
|
|
215
|
+
preview.textContent = ( localizeWithPath(
|
|
216
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
217
|
+
'preview',
|
|
218
|
+
"Preview"
|
|
219
|
+
));
|
|
220
|
+
const builtin = append(title, $('span.builtin'));
|
|
221
|
+
builtin.textContent = ( localizeWithPath(
|
|
222
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
223
|
+
'builtin',
|
|
224
|
+
"Built-in"
|
|
225
|
+
));
|
|
226
|
+
const subtitle = append(details, $('.subtitle'));
|
|
227
|
+
const publisher = append(append(subtitle, $('.subtitle-entry')), $('.publisher.clickable', { title: ( localizeWithPath(
|
|
228
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
229
|
+
'publisher',
|
|
230
|
+
"Publisher"
|
|
231
|
+
)), tabIndex: 0 }));
|
|
232
|
+
publisher.setAttribute('role', 'button');
|
|
233
|
+
const publisherDisplayName = append(publisher, $('.publisher-name'));
|
|
234
|
+
const verifiedPublisherWidget = this.instantiationService.createInstance(VerifiedPublisherWidget, append(publisher, $('.verified-publisher')), false);
|
|
235
|
+
const installCount = append(append(subtitle, $('.subtitle-entry')), $('span.install', { title: ( localizeWithPath(
|
|
236
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
237
|
+
'install count',
|
|
238
|
+
"Install count"
|
|
239
|
+
)), tabIndex: 0 }));
|
|
240
|
+
const installCountWidget = this.instantiationService.createInstance(InstallCountWidget, installCount, false);
|
|
241
|
+
const rating = append(append(subtitle, $('.subtitle-entry')), $('span.rating.clickable', { title: ( localizeWithPath(
|
|
242
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
243
|
+
'rating',
|
|
244
|
+
"Rating"
|
|
245
|
+
)), tabIndex: 0 }));
|
|
246
|
+
rating.setAttribute('role', 'link');
|
|
247
|
+
const ratingsWidget = this.instantiationService.createInstance(RatingsWidget, rating, false);
|
|
248
|
+
const sponsorWidget = this.instantiationService.createInstance(SponsorWidget, append(subtitle, $('.subtitle-entry')));
|
|
249
|
+
const widgets = [
|
|
250
|
+
remoteBadge,
|
|
251
|
+
versionWidget,
|
|
252
|
+
preReleaseWidget,
|
|
253
|
+
verifiedPublisherWidget,
|
|
254
|
+
installCountWidget,
|
|
255
|
+
ratingsWidget,
|
|
256
|
+
sponsorWidget,
|
|
257
|
+
];
|
|
258
|
+
const description = append(details, $('.description'));
|
|
259
|
+
const installAction = this.instantiationService.createInstance(InstallDropdownAction);
|
|
260
|
+
const actions = [
|
|
261
|
+
this.instantiationService.createInstance(ReloadAction),
|
|
262
|
+
this.instantiationService.createInstance(ExtensionStatusLabelAction),
|
|
263
|
+
this.instantiationService.createInstance(ActionWithDropDownAction, 'extensions.updateActions', '', [[this.instantiationService.createInstance(UpdateAction, true)], [this.instantiationService.createInstance(SkipUpdateAction)]]),
|
|
264
|
+
this.instantiationService.createInstance(SetColorThemeAction),
|
|
265
|
+
this.instantiationService.createInstance(SetFileIconThemeAction),
|
|
266
|
+
this.instantiationService.createInstance(SetProductIconThemeAction),
|
|
267
|
+
this.instantiationService.createInstance(SetLanguageAction),
|
|
268
|
+
this.instantiationService.createInstance(ClearLanguageAction),
|
|
269
|
+
this.instantiationService.createInstance(EnableDropDownAction),
|
|
270
|
+
this.instantiationService.createInstance(DisableDropDownAction),
|
|
271
|
+
this.instantiationService.createInstance(RemoteInstallAction, false),
|
|
272
|
+
this.instantiationService.createInstance(LocalInstallAction),
|
|
273
|
+
this.instantiationService.createInstance(WebInstallAction),
|
|
274
|
+
installAction,
|
|
275
|
+
this.instantiationService.createInstance(InstallingLabelAction),
|
|
276
|
+
this.instantiationService.createInstance(ActionWithDropDownAction, 'extensions.uninstall', UninstallAction.UninstallLabel, [
|
|
277
|
+
[
|
|
278
|
+
this.instantiationService.createInstance(MigrateDeprecatedExtensionAction, false),
|
|
279
|
+
this.instantiationService.createInstance(UninstallAction),
|
|
280
|
+
this.instantiationService.createInstance(InstallAnotherVersionAction),
|
|
281
|
+
]
|
|
282
|
+
]),
|
|
283
|
+
this.instantiationService.createInstance(SwitchToPreReleaseVersionAction, false),
|
|
284
|
+
this.instantiationService.createInstance(SwitchToReleasedVersionAction, false),
|
|
285
|
+
this.instantiationService.createInstance(ToggleSyncExtensionAction),
|
|
286
|
+
( new ExtensionEditorManageExtensionAction(
|
|
287
|
+
this.scopedContextKeyService || this.contextKeyService,
|
|
288
|
+
this.instantiationService
|
|
289
|
+
)),
|
|
290
|
+
];
|
|
291
|
+
const actionsAndStatusContainer = append(details, $('.actions-status-container'));
|
|
292
|
+
const extensionActionBar = this._register(( new ActionBar(actionsAndStatusContainer, {
|
|
293
|
+
animated: false,
|
|
294
|
+
actionViewItemProvider: (action) => {
|
|
295
|
+
if (action instanceof ExtensionDropDownAction) {
|
|
296
|
+
return action.createActionViewItem();
|
|
297
|
+
}
|
|
298
|
+
if (action instanceof ActionWithDropDownAction) {
|
|
299
|
+
return ( new ExtensionActionWithDropdownActionViewItem(
|
|
300
|
+
action,
|
|
301
|
+
{ icon: true, label: true, menuActionsOrProvider: { getActions: () => action.menuActions }, menuActionClassNames: (action.class || '').split(' ') },
|
|
302
|
+
this.contextMenuService
|
|
303
|
+
));
|
|
304
|
+
}
|
|
305
|
+
return undefined;
|
|
306
|
+
},
|
|
307
|
+
focusOnlyEnabledItems: true
|
|
308
|
+
})));
|
|
309
|
+
extensionActionBar.push(actions, { icon: true, label: true });
|
|
310
|
+
extensionActionBar.setFocusable(true);
|
|
311
|
+
this._register(Event.any(...( actions.map(a => Event.filter(a.onDidChange, e => e.enabled !== undefined))))(() => {
|
|
312
|
+
extensionActionBar.setFocusable(false);
|
|
313
|
+
extensionActionBar.setFocusable(true);
|
|
314
|
+
}));
|
|
315
|
+
const otherExtensionContainers = [];
|
|
316
|
+
const extensionStatusAction = this.instantiationService.createInstance(ExtensionStatusAction);
|
|
317
|
+
const extensionStatusWidget = this._register(this.instantiationService.createInstance(ExtensionStatusWidget, append(actionsAndStatusContainer, $('.status')), extensionStatusAction));
|
|
318
|
+
otherExtensionContainers.push(extensionStatusAction, new (class extends ExtensionWidget {
|
|
319
|
+
render() {
|
|
320
|
+
actionsAndStatusContainer.classList.toggle('list-layout', this.extension?.state === 1 );
|
|
321
|
+
}
|
|
322
|
+
})());
|
|
323
|
+
const recommendationWidget = this.instantiationService.createInstance(ExtensionRecommendationWidget, append(details, $('.recommendation')));
|
|
324
|
+
widgets.push(recommendationWidget);
|
|
325
|
+
this._register(Event.any(extensionStatusWidget.onDidRender, recommendationWidget.onDidRender)(() => {
|
|
326
|
+
if (this.dimension) {
|
|
327
|
+
this.layout(this.dimension);
|
|
328
|
+
}
|
|
329
|
+
}));
|
|
330
|
+
const extensionContainers = this.instantiationService.createInstance(ExtensionContainers, [...actions, ...widgets, ...otherExtensionContainers]);
|
|
331
|
+
for (const disposable of [...actions, ...widgets, ...otherExtensionContainers, extensionContainers]) {
|
|
332
|
+
this._register(disposable);
|
|
333
|
+
}
|
|
334
|
+
const onError = Event.chain(extensionActionBar.onDidRun, $ => ( $.map(({ error }) => error))
|
|
335
|
+
.filter(error => !!error));
|
|
336
|
+
this._register(onError(this.onError, this));
|
|
337
|
+
const body = append(root, $('.body'));
|
|
338
|
+
const navbar = ( new NavBar(body));
|
|
339
|
+
const content = append(body, $('.content'));
|
|
340
|
+
content.id = generateUuid();
|
|
341
|
+
this.template = {
|
|
342
|
+
builtin,
|
|
343
|
+
content,
|
|
344
|
+
description,
|
|
345
|
+
header,
|
|
346
|
+
icon,
|
|
347
|
+
iconContainer,
|
|
348
|
+
installCount,
|
|
349
|
+
name,
|
|
350
|
+
navbar,
|
|
351
|
+
preview,
|
|
352
|
+
publisher,
|
|
353
|
+
publisherDisplayName,
|
|
354
|
+
rating,
|
|
355
|
+
actionsAndStatusContainer,
|
|
356
|
+
extensionActionBar,
|
|
357
|
+
set extension(extension) {
|
|
358
|
+
extensionContainers.extension = extension;
|
|
359
|
+
},
|
|
360
|
+
set gallery(gallery) {
|
|
361
|
+
versionWidget.gallery = gallery;
|
|
362
|
+
preReleaseWidget.gallery = gallery;
|
|
363
|
+
},
|
|
364
|
+
set manifest(manifest) {
|
|
365
|
+
installAction.manifest = manifest;
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
async setInput(input, options, context, token) {
|
|
370
|
+
await super.setInput(input, options, context, token);
|
|
371
|
+
this.updatePreReleaseVersionContext();
|
|
372
|
+
if (this.template) {
|
|
373
|
+
await this.render(input.extension, this.template, !!options?.preserveFocus);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
setOptions(options) {
|
|
377
|
+
const currentOptions = this.options;
|
|
378
|
+
super.setOptions(options);
|
|
379
|
+
this.updatePreReleaseVersionContext();
|
|
380
|
+
if (this.input && this.template && currentOptions?.showPreReleaseVersion !== options?.showPreReleaseVersion) {
|
|
381
|
+
this.render(this.input.extension, this.template, !!options?.preserveFocus);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
updatePreReleaseVersionContext() {
|
|
385
|
+
let showPreReleaseVersion = this.options?.showPreReleaseVersion;
|
|
386
|
+
if (isUndefined(showPreReleaseVersion)) {
|
|
387
|
+
showPreReleaseVersion = !!this.input.extension.gallery?.properties.isPreReleaseVersion;
|
|
388
|
+
}
|
|
389
|
+
this.showPreReleaseVersionContextKey?.set(showPreReleaseVersion);
|
|
390
|
+
}
|
|
391
|
+
async openTab(tab) {
|
|
392
|
+
if (!this.input || !this.template) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
if (this.template.navbar.switch(tab)) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (tab === "extensionPack" ) {
|
|
399
|
+
this.template.navbar.switch("readme" );
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
async getGalleryVersionToShow(extension, preRelease) {
|
|
403
|
+
if (isUndefined(preRelease)) {
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
406
|
+
if (preRelease === extension.gallery?.properties.isPreReleaseVersion) {
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
if (preRelease && !extension.hasPreReleaseVersion) {
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
if (!preRelease && !extension.hasReleaseVersion) {
|
|
413
|
+
return null;
|
|
414
|
+
}
|
|
415
|
+
return (await this.extensionGalleryService.getExtensions([{ ...extension.identifier, preRelease, hasPreRelease: extension.hasPreReleaseVersion }], CancellationToken.None))[0] || null;
|
|
416
|
+
}
|
|
417
|
+
async render(extension, template, preserveFocus) {
|
|
418
|
+
this.activeElement = null;
|
|
419
|
+
this.transientDisposables.clear();
|
|
420
|
+
const token = this.transientDisposables.add(( new CancellationTokenSource())).token;
|
|
421
|
+
const gallery = await this.getGalleryVersionToShow(extension, this.options?.showPreReleaseVersion);
|
|
422
|
+
if (token.isCancellationRequested) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
this.extensionReadme = ( new Cache(
|
|
426
|
+
() => gallery ? this.extensionGalleryService.getReadme(gallery, token) : extension.getReadme(token)
|
|
427
|
+
));
|
|
428
|
+
this.extensionChangelog = ( new Cache(
|
|
429
|
+
() => gallery ? this.extensionGalleryService.getChangelog(gallery, token) : extension.getChangelog(token)
|
|
430
|
+
));
|
|
431
|
+
this.extensionManifest = ( new Cache(
|
|
432
|
+
() => gallery ? this.extensionGalleryService.getManifest(gallery, token) : extension.getManifest(token)
|
|
433
|
+
));
|
|
434
|
+
template.extension = extension;
|
|
435
|
+
template.gallery = gallery;
|
|
436
|
+
template.manifest = null;
|
|
437
|
+
this.transientDisposables.add(addDisposableListener(template.icon, 'error', () => template.icon.src = extension.iconUrlFallback, { once: true }));
|
|
438
|
+
template.icon.src = extension.iconUrl;
|
|
439
|
+
template.name.textContent = extension.displayName;
|
|
440
|
+
template.name.classList.toggle('clickable', !!extension.url);
|
|
441
|
+
template.name.classList.toggle('deprecated', !!extension.deprecationInfo);
|
|
442
|
+
template.preview.style.display = extension.preview ? 'inherit' : 'none';
|
|
443
|
+
template.builtin.style.display = extension.isBuiltin ? 'inherit' : 'none';
|
|
444
|
+
template.description.textContent = extension.description;
|
|
445
|
+
template.publisher.classList.toggle('clickable', !!extension.url);
|
|
446
|
+
template.publisherDisplayName.textContent = extension.publisherDisplayName;
|
|
447
|
+
template.installCount.parentElement?.classList.toggle('hide', !extension.url);
|
|
448
|
+
template.rating.parentElement?.classList.toggle('hide', !extension.url);
|
|
449
|
+
template.rating.classList.toggle('clickable', !!extension.url);
|
|
450
|
+
if (extension.url) {
|
|
451
|
+
this.transientDisposables.add(onClick(template.name, () => this.openerService.open(( URI.parse(extension.url)))));
|
|
452
|
+
this.transientDisposables.add(onClick(template.rating, () => this.openerService.open(( URI.parse(`${extension.url}&ssr=false#review-details`)))));
|
|
453
|
+
this.transientDisposables.add(onClick(template.publisher, () => {
|
|
454
|
+
this.paneCompositeService.openPaneComposite(VIEWLET_ID, 0 , true)
|
|
455
|
+
.then(viewlet => viewlet?.getViewPaneContainer())
|
|
456
|
+
.then(viewlet => viewlet.search(`publisher:"${extension.publisherDisplayName}"`));
|
|
457
|
+
}));
|
|
458
|
+
}
|
|
459
|
+
const manifest = await this.extensionManifest.get().promise;
|
|
460
|
+
if (token.isCancellationRequested) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
if (manifest) {
|
|
464
|
+
template.manifest = manifest;
|
|
465
|
+
}
|
|
466
|
+
this.renderNavbar(extension, manifest, template, preserveFocus);
|
|
467
|
+
const extRecommendations = this.extensionRecommendationsService.getAllRecommendationsWithReason();
|
|
468
|
+
let recommendationsData = {};
|
|
469
|
+
if (extRecommendations[extension.identifier.id.toLowerCase()]) {
|
|
470
|
+
recommendationsData = { recommendationReason: extRecommendations[extension.identifier.id.toLowerCase()].reasonId };
|
|
471
|
+
}
|
|
472
|
+
this.telemetryService.publicLog('extensionGallery:openExtension', { ...extension.telemetryData, ...recommendationsData });
|
|
473
|
+
}
|
|
474
|
+
renderNavbar(extension, manifest, template, preserveFocus) {
|
|
475
|
+
template.content.innerText = '';
|
|
476
|
+
template.navbar.clear();
|
|
477
|
+
if (this.currentIdentifier !== extension.identifier.id) {
|
|
478
|
+
this.initialScrollProgress.clear();
|
|
479
|
+
this.currentIdentifier = extension.identifier.id;
|
|
480
|
+
}
|
|
481
|
+
if (extension.hasReadme()) {
|
|
482
|
+
template.navbar.push("readme" , ( localizeWithPath(
|
|
483
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
484
|
+
'details',
|
|
485
|
+
"Details"
|
|
486
|
+
)), ( localizeWithPath(
|
|
487
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
488
|
+
'detailstooltip',
|
|
489
|
+
"Extension details, rendered from the extension's 'README.md' file"
|
|
490
|
+
)));
|
|
491
|
+
}
|
|
492
|
+
if (manifest && manifest.contributes) {
|
|
493
|
+
template.navbar.push("contributions" , ( localizeWithPath(
|
|
494
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
495
|
+
'contributions',
|
|
496
|
+
"Feature Contributions"
|
|
497
|
+
)), ( localizeWithPath(
|
|
498
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
499
|
+
'contributionstooltip',
|
|
500
|
+
"Lists contributions to VS Code by this extension"
|
|
501
|
+
)));
|
|
502
|
+
}
|
|
503
|
+
if (extension.hasChangelog()) {
|
|
504
|
+
template.navbar.push("changelog" , ( localizeWithPath(
|
|
505
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
506
|
+
'changelog',
|
|
507
|
+
"Changelog"
|
|
508
|
+
)), ( localizeWithPath(
|
|
509
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
510
|
+
'changelogtooltip',
|
|
511
|
+
"Extension update history, rendered from the extension's 'CHANGELOG.md' file"
|
|
512
|
+
)));
|
|
513
|
+
}
|
|
514
|
+
if (extension.dependencies.length) {
|
|
515
|
+
template.navbar.push("dependencies" , ( localizeWithPath(
|
|
516
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
517
|
+
'dependencies',
|
|
518
|
+
"Dependencies"
|
|
519
|
+
)), ( localizeWithPath(
|
|
520
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
521
|
+
'dependenciestooltip',
|
|
522
|
+
"Lists extensions this extension depends on"
|
|
523
|
+
)));
|
|
524
|
+
}
|
|
525
|
+
if (manifest && manifest.extensionPack?.length && !this.shallRenderAsExtensionPack(manifest)) {
|
|
526
|
+
template.navbar.push("extensionPack" , ( localizeWithPath(
|
|
527
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
528
|
+
'extensionpack',
|
|
529
|
+
"Extension Pack"
|
|
530
|
+
)), ( localizeWithPath(
|
|
531
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
532
|
+
'extensionpacktooltip',
|
|
533
|
+
"Lists extensions those will be installed together with this extension"
|
|
534
|
+
)));
|
|
535
|
+
}
|
|
536
|
+
const addRuntimeStatusSection = () => template.navbar.push("runtimeStatus" , ( localizeWithPath(
|
|
537
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
538
|
+
'runtimeStatus',
|
|
539
|
+
"Runtime Status"
|
|
540
|
+
)), ( localizeWithPath(
|
|
541
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
542
|
+
'runtimeStatus description',
|
|
543
|
+
"Extension runtime status"
|
|
544
|
+
)));
|
|
545
|
+
if (this.extensionsWorkbenchService.getExtensionStatus(extension)) {
|
|
546
|
+
addRuntimeStatusSection();
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
const disposable = this.extensionService.onDidChangeExtensionsStatus(e => {
|
|
550
|
+
if (( e.some(
|
|
551
|
+
extensionIdentifier => areSameExtensions({ id: extensionIdentifier.value }, extension.identifier)
|
|
552
|
+
))) {
|
|
553
|
+
addRuntimeStatusSection();
|
|
554
|
+
disposable.dispose();
|
|
555
|
+
}
|
|
556
|
+
}, this, this.transientDisposables);
|
|
557
|
+
}
|
|
558
|
+
if (template.navbar.currentId) {
|
|
559
|
+
this.onNavbarChange(extension, { id: template.navbar.currentId, focus: !preserveFocus }, template);
|
|
560
|
+
}
|
|
561
|
+
template.navbar.onChange(e => this.onNavbarChange(extension, e, template), this, this.transientDisposables);
|
|
562
|
+
}
|
|
563
|
+
clearInput() {
|
|
564
|
+
this.contentDisposables.clear();
|
|
565
|
+
this.transientDisposables.clear();
|
|
566
|
+
super.clearInput();
|
|
567
|
+
}
|
|
568
|
+
focus() {
|
|
569
|
+
this.activeElement?.focus();
|
|
570
|
+
}
|
|
571
|
+
showFind() {
|
|
572
|
+
this.activeWebview?.showFind();
|
|
573
|
+
}
|
|
574
|
+
runFindAction(previous) {
|
|
575
|
+
this.activeWebview?.runFindAction(previous);
|
|
576
|
+
}
|
|
577
|
+
get activeWebview() {
|
|
578
|
+
if (!this.activeElement || !this.activeElement.runFindAction) {
|
|
579
|
+
return undefined;
|
|
580
|
+
}
|
|
581
|
+
return this.activeElement;
|
|
582
|
+
}
|
|
583
|
+
onNavbarChange(extension, { id, focus }, template) {
|
|
584
|
+
this.contentDisposables.clear();
|
|
585
|
+
template.content.innerText = '';
|
|
586
|
+
this.activeElement = null;
|
|
587
|
+
if (id) {
|
|
588
|
+
const cts = ( new CancellationTokenSource());
|
|
589
|
+
this.contentDisposables.add(toDisposable(() => cts.dispose(true)));
|
|
590
|
+
this.open(id, extension, template, cts.token)
|
|
591
|
+
.then(activeElement => {
|
|
592
|
+
if (cts.token.isCancellationRequested) {
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
this.activeElement = activeElement;
|
|
596
|
+
if (focus) {
|
|
597
|
+
this.focus();
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
open(id, extension, template, token) {
|
|
603
|
+
switch (id) {
|
|
604
|
+
case "readme" : return this.openDetails(extension, template, token);
|
|
605
|
+
case "contributions" : return this.openContributions(template, token);
|
|
606
|
+
case "changelog" : return this.openChangelog(template, token);
|
|
607
|
+
case "dependencies" : return this.openExtensionDependencies(extension, template, token);
|
|
608
|
+
case "extensionPack" : return this.openExtensionPack(extension, template, token);
|
|
609
|
+
case "runtimeStatus" : return this.openRuntimeStatus(extension, template, token);
|
|
610
|
+
}
|
|
611
|
+
return Promise.resolve(null);
|
|
612
|
+
}
|
|
613
|
+
async openMarkdown(cacheResult, noContentCopy, container, webviewIndex, title, token) {
|
|
614
|
+
try {
|
|
615
|
+
const body = await this.renderMarkdown(cacheResult, container, token);
|
|
616
|
+
if (token.isCancellationRequested) {
|
|
617
|
+
return Promise.resolve(null);
|
|
618
|
+
}
|
|
619
|
+
const webview = this.contentDisposables.add(this.webviewService.createWebviewOverlay({
|
|
620
|
+
title,
|
|
621
|
+
options: {
|
|
622
|
+
enableFindWidget: true,
|
|
623
|
+
tryRestoreScrollPosition: true,
|
|
624
|
+
disableServiceWorker: true,
|
|
625
|
+
},
|
|
626
|
+
contentOptions: {},
|
|
627
|
+
extension: undefined,
|
|
628
|
+
}));
|
|
629
|
+
webview.initialScrollProgress = this.initialScrollProgress.get(webviewIndex) || 0;
|
|
630
|
+
webview.claim(this, this.scopedContextKeyService);
|
|
631
|
+
setParentFlowTo(webview.container, container);
|
|
632
|
+
webview.layoutWebviewOverElement(container);
|
|
633
|
+
webview.setHtml(body);
|
|
634
|
+
webview.claim(this, undefined);
|
|
635
|
+
this.contentDisposables.add(webview.onDidFocus(() => this.fireOnDidFocus()));
|
|
636
|
+
this.contentDisposables.add(webview.onDidScroll(() => this.initialScrollProgress.set(webviewIndex, webview.initialScrollProgress)));
|
|
637
|
+
const removeLayoutParticipant = arrays.insert(this.layoutParticipants, {
|
|
638
|
+
layout: () => {
|
|
639
|
+
webview.layoutWebviewOverElement(container);
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
this.contentDisposables.add(toDisposable(removeLayoutParticipant));
|
|
643
|
+
let isDisposed = false;
|
|
644
|
+
this.contentDisposables.add(toDisposable(() => { isDisposed = true; }));
|
|
645
|
+
this.contentDisposables.add(this.themeService.onDidColorThemeChange(async () => {
|
|
646
|
+
const body = await this.renderMarkdown(cacheResult, container);
|
|
647
|
+
if (!isDisposed) {
|
|
648
|
+
webview.setHtml(body);
|
|
649
|
+
}
|
|
650
|
+
}));
|
|
651
|
+
this.contentDisposables.add(webview.onDidClickLink(link => {
|
|
652
|
+
if (!link) {
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
if (matchesScheme(link, Schemas.http) || matchesScheme(link, Schemas.https) || matchesScheme(link, Schemas.mailto)) {
|
|
656
|
+
this.openerService.open(link);
|
|
657
|
+
}
|
|
658
|
+
if (matchesScheme(link, Schemas.command) && ( URI.parse(link)).path === ShowCurrentReleaseNotesActionId) {
|
|
659
|
+
this.openerService.open(link, { allowCommands: true });
|
|
660
|
+
}
|
|
661
|
+
}));
|
|
662
|
+
return webview;
|
|
663
|
+
}
|
|
664
|
+
catch (e) {
|
|
665
|
+
const p = append(container, $('p.nocontent'));
|
|
666
|
+
p.textContent = noContentCopy;
|
|
667
|
+
return p;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
async renderMarkdown(cacheResult, container, token) {
|
|
671
|
+
const contents = await this.loadContents(() => cacheResult, container);
|
|
672
|
+
if (token?.isCancellationRequested) {
|
|
673
|
+
return '';
|
|
674
|
+
}
|
|
675
|
+
const content = await renderMarkdownDocument(contents, this.extensionService, this.languageService, true, false, token);
|
|
676
|
+
if (token?.isCancellationRequested) {
|
|
677
|
+
return '';
|
|
678
|
+
}
|
|
679
|
+
return this.renderBody(content);
|
|
680
|
+
}
|
|
681
|
+
renderBody(body) {
|
|
682
|
+
const nonce = generateUuid();
|
|
683
|
+
const colorMap = TokenizationRegistry.getColorMap();
|
|
684
|
+
const css = colorMap ? generateTokensCSSForColorMap(colorMap) : '';
|
|
685
|
+
return `<!DOCTYPE html>
|
|
686
|
+
<html>
|
|
687
|
+
<head>
|
|
688
|
+
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
|
689
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; script-src 'none'; style-src 'nonce-${nonce}';">
|
|
690
|
+
<style nonce="${nonce}">
|
|
691
|
+
${DEFAULT_MARKDOWN_STYLES}
|
|
692
|
+
|
|
693
|
+
/* prevent scroll-to-top button from blocking the body text */
|
|
694
|
+
body {
|
|
695
|
+
padding-bottom: 75px;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
#scroll-to-top {
|
|
699
|
+
position: fixed;
|
|
700
|
+
width: 32px;
|
|
701
|
+
height: 32px;
|
|
702
|
+
right: 25px;
|
|
703
|
+
bottom: 25px;
|
|
704
|
+
background-color: var(--vscode-button-secondaryBackground);
|
|
705
|
+
border-color: var(--vscode-button-border);
|
|
706
|
+
border-radius: 50%;
|
|
707
|
+
cursor: pointer;
|
|
708
|
+
box-shadow: 1px 1px 1px rgba(0,0,0,.25);
|
|
709
|
+
outline: none;
|
|
710
|
+
display: flex;
|
|
711
|
+
justify-content: center;
|
|
712
|
+
align-items: center;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
#scroll-to-top:hover {
|
|
716
|
+
background-color: var(--vscode-button-secondaryHoverBackground);
|
|
717
|
+
box-shadow: 2px 2px 2px rgba(0,0,0,.25);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
body.vscode-high-contrast #scroll-to-top {
|
|
721
|
+
border-width: 2px;
|
|
722
|
+
border-style: solid;
|
|
723
|
+
box-shadow: none;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
#scroll-to-top span.icon::before {
|
|
727
|
+
content: "";
|
|
728
|
+
display: block;
|
|
729
|
+
background: var(--vscode-button-secondaryForeground);
|
|
730
|
+
/* Chevron up icon */
|
|
731
|
+
webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
|
|
732
|
+
-webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
|
|
733
|
+
width: 16px;
|
|
734
|
+
height: 16px;
|
|
735
|
+
}
|
|
736
|
+
${css}
|
|
737
|
+
</style>
|
|
738
|
+
</head>
|
|
739
|
+
<body>
|
|
740
|
+
<a id="scroll-to-top" role="button" aria-label="scroll to top" href="#"><span class="icon"></span></a>
|
|
741
|
+
${body}
|
|
742
|
+
</body>
|
|
743
|
+
</html>`;
|
|
744
|
+
}
|
|
745
|
+
async openDetails(extension, template, token) {
|
|
746
|
+
const details = append(template.content, $('.details'));
|
|
747
|
+
const readmeContainer = append(details, $('.readme-container'));
|
|
748
|
+
const additionalDetailsContainer = append(details, $('.additional-details-container'));
|
|
749
|
+
const layout = () => details.classList.toggle('narrow', this.dimension && this.dimension.width < 500);
|
|
750
|
+
layout();
|
|
751
|
+
this.contentDisposables.add(toDisposable(arrays.insert(this.layoutParticipants, { layout })));
|
|
752
|
+
let activeElement = null;
|
|
753
|
+
const manifest = await this.extensionManifest.get().promise;
|
|
754
|
+
if (manifest && manifest.extensionPack?.length && this.shallRenderAsExtensionPack(manifest)) {
|
|
755
|
+
activeElement = await this.openExtensionPackReadme(manifest, readmeContainer, token);
|
|
756
|
+
}
|
|
757
|
+
else {
|
|
758
|
+
activeElement = await this.openMarkdown(this.extensionReadme.get(), ( localizeWithPath(
|
|
759
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
760
|
+
'noReadme',
|
|
761
|
+
"No README available."
|
|
762
|
+
)), readmeContainer, 0 , ( localizeWithPath(
|
|
763
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
764
|
+
'Readme title',
|
|
765
|
+
"Readme"
|
|
766
|
+
)), token);
|
|
767
|
+
}
|
|
768
|
+
this.renderAdditionalDetails(additionalDetailsContainer, extension);
|
|
769
|
+
return activeElement;
|
|
770
|
+
}
|
|
771
|
+
shallRenderAsExtensionPack(manifest) {
|
|
772
|
+
return !!(manifest.categories?.some(category => category.toLowerCase() === 'extension packs'));
|
|
773
|
+
}
|
|
774
|
+
async openExtensionPackReadme(manifest, container, token) {
|
|
775
|
+
if (token.isCancellationRequested) {
|
|
776
|
+
return Promise.resolve(null);
|
|
777
|
+
}
|
|
778
|
+
const extensionPackReadme = append(container, $('div', { class: 'extension-pack-readme' }));
|
|
779
|
+
extensionPackReadme.style.margin = '0 auto';
|
|
780
|
+
extensionPackReadme.style.maxWidth = '882px';
|
|
781
|
+
const extensionPack = append(extensionPackReadme, $('div', { class: 'extension-pack' }));
|
|
782
|
+
if (manifest.extensionPack.length <= 3) {
|
|
783
|
+
extensionPackReadme.classList.add('one-row');
|
|
784
|
+
}
|
|
785
|
+
else if (manifest.extensionPack.length <= 6) {
|
|
786
|
+
extensionPackReadme.classList.add('two-rows');
|
|
787
|
+
}
|
|
788
|
+
else if (manifest.extensionPack.length <= 9) {
|
|
789
|
+
extensionPackReadme.classList.add('three-rows');
|
|
790
|
+
}
|
|
791
|
+
else {
|
|
792
|
+
extensionPackReadme.classList.add('more-rows');
|
|
793
|
+
}
|
|
794
|
+
const extensionPackHeader = append(extensionPack, $('div.header'));
|
|
795
|
+
extensionPackHeader.textContent = ( localizeWithPath(
|
|
796
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
797
|
+
'extension pack',
|
|
798
|
+
"Extension Pack ({0})",
|
|
799
|
+
manifest.extensionPack.length
|
|
800
|
+
));
|
|
801
|
+
const extensionPackContent = append(extensionPack, $('div', { class: 'extension-pack-content' }));
|
|
802
|
+
extensionPackContent.setAttribute('tabindex', '0');
|
|
803
|
+
append(extensionPack, $('div.footer'));
|
|
804
|
+
const readmeContent = append(extensionPackReadme, $('div.readme-content'));
|
|
805
|
+
await Promise.all([
|
|
806
|
+
this.renderExtensionPack(manifest, extensionPackContent, token),
|
|
807
|
+
this.openMarkdown(this.extensionReadme.get(), ( localizeWithPath(
|
|
808
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
809
|
+
'noReadme',
|
|
810
|
+
"No README available."
|
|
811
|
+
)), readmeContent, 0 , ( localizeWithPath(
|
|
812
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
813
|
+
'Readme title',
|
|
814
|
+
"Readme"
|
|
815
|
+
)), token),
|
|
816
|
+
]);
|
|
817
|
+
return { focus: () => extensionPackContent.focus() };
|
|
818
|
+
}
|
|
819
|
+
renderAdditionalDetails(container, extension) {
|
|
820
|
+
const content = $('div', { class: 'additional-details-content', tabindex: '0' });
|
|
821
|
+
const scrollableContent = ( new DomScrollableElement(content, {}));
|
|
822
|
+
const layout = () => scrollableContent.scanDomNode();
|
|
823
|
+
const removeLayoutParticipant = arrays.insert(this.layoutParticipants, { layout });
|
|
824
|
+
this.contentDisposables.add(toDisposable(removeLayoutParticipant));
|
|
825
|
+
this.contentDisposables.add(scrollableContent);
|
|
826
|
+
this.renderCategories(content, extension);
|
|
827
|
+
this.renderExtensionResources(content, extension);
|
|
828
|
+
this.renderMoreInfo(content, extension);
|
|
829
|
+
append(container, scrollableContent.getDomNode());
|
|
830
|
+
scrollableContent.scanDomNode();
|
|
831
|
+
}
|
|
832
|
+
renderCategories(container, extension) {
|
|
833
|
+
if (extension.categories.length) {
|
|
834
|
+
const categoriesContainer = append(container, $('.categories-container.additional-details-element'));
|
|
835
|
+
append(categoriesContainer, $('.additional-details-title', undefined, ( localizeWithPath(
|
|
836
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
837
|
+
'categories',
|
|
838
|
+
"Categories"
|
|
839
|
+
))));
|
|
840
|
+
const categoriesElement = append(categoriesContainer, $('.categories'));
|
|
841
|
+
for (const category of extension.categories) {
|
|
842
|
+
this.transientDisposables.add(onClick(append(categoriesElement, $('span.category', { tabindex: '0' }, category)), () => {
|
|
843
|
+
this.paneCompositeService.openPaneComposite(VIEWLET_ID, 0 , true)
|
|
844
|
+
.then(viewlet => viewlet?.getViewPaneContainer())
|
|
845
|
+
.then(viewlet => viewlet.search(`@category:"${category}"`));
|
|
846
|
+
}));
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
renderExtensionResources(container, extension) {
|
|
851
|
+
const resources = [];
|
|
852
|
+
if (extension.url) {
|
|
853
|
+
resources.push([( localizeWithPath(
|
|
854
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
855
|
+
'Marketplace',
|
|
856
|
+
"Marketplace"
|
|
857
|
+
)), ( URI.parse(extension.url))]);
|
|
858
|
+
}
|
|
859
|
+
if (extension.repository) {
|
|
860
|
+
try {
|
|
861
|
+
resources.push([( localizeWithPath(
|
|
862
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
863
|
+
'repository',
|
|
864
|
+
"Repository"
|
|
865
|
+
)), ( URI.parse(extension.repository))]);
|
|
866
|
+
}
|
|
867
|
+
catch (error) { }
|
|
868
|
+
}
|
|
869
|
+
if (extension.url && extension.licenseUrl) {
|
|
870
|
+
try {
|
|
871
|
+
resources.push([( localizeWithPath(
|
|
872
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
873
|
+
'license',
|
|
874
|
+
"License"
|
|
875
|
+
)), ( URI.parse(extension.licenseUrl))]);
|
|
876
|
+
}
|
|
877
|
+
catch (error) { }
|
|
878
|
+
}
|
|
879
|
+
if (extension.publisherUrl) {
|
|
880
|
+
resources.push([extension.publisherDisplayName, extension.publisherUrl]);
|
|
881
|
+
}
|
|
882
|
+
if (resources.length || extension.publisherSponsorLink) {
|
|
883
|
+
const extensionResourcesContainer = append(container, $('.resources-container.additional-details-element'));
|
|
884
|
+
append(extensionResourcesContainer, $('.additional-details-title', undefined, ( localizeWithPath(
|
|
885
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
886
|
+
'resources',
|
|
887
|
+
"Extension Resources"
|
|
888
|
+
))));
|
|
889
|
+
const resourcesElement = append(extensionResourcesContainer, $('.resources'));
|
|
890
|
+
for (const [label, uri] of resources) {
|
|
891
|
+
this.transientDisposables.add(onClick(append(resourcesElement, $('a.resource', { title: ( uri.toString()), tabindex: '0' }, label)), () => this.openerService.open(uri)));
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
renderMoreInfo(container, extension) {
|
|
896
|
+
const gallery = extension.gallery;
|
|
897
|
+
const moreInfoContainer = append(container, $('.more-info-container.additional-details-element'));
|
|
898
|
+
append(moreInfoContainer, $('.additional-details-title', undefined, ( localizeWithPath(
|
|
899
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
900
|
+
'Marketplace Info',
|
|
901
|
+
"More Info"
|
|
902
|
+
))));
|
|
903
|
+
const moreInfo = append(moreInfoContainer, $('.more-info'));
|
|
904
|
+
const toDateString = (date) => `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}, ${date.toLocaleTimeString(language, { hourCycle: 'h23' })}`;
|
|
905
|
+
if (gallery) {
|
|
906
|
+
append(moreInfo, $('.more-info-entry', undefined, $('div', undefined, ( localizeWithPath(
|
|
907
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
908
|
+
'published',
|
|
909
|
+
"Published"
|
|
910
|
+
))), $('div', undefined, toDateString(( new Date(gallery.releaseDate))))), $('.more-info-entry', undefined, $('div', undefined, ( localizeWithPath(
|
|
911
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
912
|
+
'last released',
|
|
913
|
+
"Last released"
|
|
914
|
+
))), $('div', undefined, toDateString(( new Date(gallery.lastUpdated))))));
|
|
915
|
+
}
|
|
916
|
+
if (extension.local && extension.local.installedTimestamp) {
|
|
917
|
+
append(moreInfo, $('.more-info-entry', undefined, $('div', undefined, ( localizeWithPath(
|
|
918
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
919
|
+
'last updated',
|
|
920
|
+
"Last updated"
|
|
921
|
+
))), $('div', undefined, toDateString(( new Date(extension.local.installedTimestamp))))));
|
|
922
|
+
}
|
|
923
|
+
append(moreInfo, $('.more-info-entry', undefined, $('div', undefined, ( localizeWithPath(
|
|
924
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
925
|
+
'id',
|
|
926
|
+
"Identifier"
|
|
927
|
+
))), $('code', undefined, extension.identifier.id)));
|
|
928
|
+
}
|
|
929
|
+
openChangelog(template, token) {
|
|
930
|
+
return this.openMarkdown(this.extensionChangelog.get(), ( localizeWithPath(
|
|
931
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
932
|
+
'noChangelog',
|
|
933
|
+
"No Changelog available."
|
|
934
|
+
)), template.content, 1 , ( localizeWithPath(
|
|
935
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
936
|
+
'Changelog title',
|
|
937
|
+
"Changelog"
|
|
938
|
+
)), token);
|
|
939
|
+
}
|
|
940
|
+
openContributions(template, token) {
|
|
941
|
+
const content = $('div.subcontent.feature-contributions', { tabindex: '0' });
|
|
942
|
+
return this.loadContents(() => this.extensionManifest.get(), template.content)
|
|
943
|
+
.then(manifest => {
|
|
944
|
+
if (token.isCancellationRequested) {
|
|
945
|
+
return null;
|
|
946
|
+
}
|
|
947
|
+
if (!manifest) {
|
|
948
|
+
return content;
|
|
949
|
+
}
|
|
950
|
+
const scrollableContent = ( new DomScrollableElement(content, {}));
|
|
951
|
+
const layout = () => scrollableContent.scanDomNode();
|
|
952
|
+
const removeLayoutParticipant = arrays.insert(this.layoutParticipants, { layout });
|
|
953
|
+
this.contentDisposables.add(toDisposable(removeLayoutParticipant));
|
|
954
|
+
const renders = [
|
|
955
|
+
this.renderSettings(content, manifest, layout),
|
|
956
|
+
this.renderCommands(content, manifest, layout),
|
|
957
|
+
this.renderCodeActions(content, manifest, layout),
|
|
958
|
+
this.renderLanguages(content, manifest, layout),
|
|
959
|
+
this.renderColorThemes(content, manifest, layout),
|
|
960
|
+
this.renderIconThemes(content, manifest, layout),
|
|
961
|
+
this.renderProductIconThemes(content, manifest, layout),
|
|
962
|
+
this.renderColors(content, manifest, layout),
|
|
963
|
+
this.renderJSONValidation(content, manifest, layout),
|
|
964
|
+
this.renderDebuggers(content, manifest, layout),
|
|
965
|
+
this.renderViewContainers(content, manifest, layout),
|
|
966
|
+
this.renderViews(content, manifest, layout),
|
|
967
|
+
this.renderLocalizations(content, manifest, layout),
|
|
968
|
+
this.renderCustomEditors(content, manifest, layout),
|
|
969
|
+
this.renderNotebooks(content, manifest, layout),
|
|
970
|
+
this.renderNotebookRenderers(content, manifest, layout),
|
|
971
|
+
this.renderAuthentication(content, manifest, layout),
|
|
972
|
+
this.renderActivationEvents(content, manifest, layout),
|
|
973
|
+
];
|
|
974
|
+
scrollableContent.scanDomNode();
|
|
975
|
+
const isEmpty = !( renders.some(x => x));
|
|
976
|
+
if (isEmpty) {
|
|
977
|
+
append(content, $('p.nocontent')).textContent = ( localizeWithPath(
|
|
978
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
979
|
+
'noContributions',
|
|
980
|
+
"No Contributions"
|
|
981
|
+
));
|
|
982
|
+
append(template.content, content);
|
|
983
|
+
}
|
|
984
|
+
else {
|
|
985
|
+
append(template.content, scrollableContent.getDomNode());
|
|
986
|
+
this.contentDisposables.add(scrollableContent);
|
|
987
|
+
}
|
|
988
|
+
return content;
|
|
989
|
+
}, () => {
|
|
990
|
+
if (token.isCancellationRequested) {
|
|
991
|
+
return null;
|
|
992
|
+
}
|
|
993
|
+
append(content, $('p.nocontent')).textContent = ( localizeWithPath(
|
|
994
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
995
|
+
'noContributions',
|
|
996
|
+
"No Contributions"
|
|
997
|
+
));
|
|
998
|
+
append(template.content, content);
|
|
999
|
+
return content;
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
openExtensionDependencies(extension, template, token) {
|
|
1003
|
+
if (token.isCancellationRequested) {
|
|
1004
|
+
return Promise.resolve(null);
|
|
1005
|
+
}
|
|
1006
|
+
if (arrays.isFalsyOrEmpty(extension.dependencies)) {
|
|
1007
|
+
append(template.content, $('p.nocontent')).textContent = ( localizeWithPath(
|
|
1008
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1009
|
+
'noDependencies',
|
|
1010
|
+
"No Dependencies"
|
|
1011
|
+
));
|
|
1012
|
+
return Promise.resolve(template.content);
|
|
1013
|
+
}
|
|
1014
|
+
const content = $('div', { class: 'subcontent' });
|
|
1015
|
+
const scrollableContent = ( new DomScrollableElement(content, {}));
|
|
1016
|
+
append(template.content, scrollableContent.getDomNode());
|
|
1017
|
+
this.contentDisposables.add(scrollableContent);
|
|
1018
|
+
const dependenciesTree = this.instantiationService.createInstance(ExtensionsTree, ( new ExtensionData(
|
|
1019
|
+
extension,
|
|
1020
|
+
null,
|
|
1021
|
+
extension => extension.dependencies || [],
|
|
1022
|
+
this.extensionsWorkbenchService
|
|
1023
|
+
)), content, {
|
|
1024
|
+
listBackground: editorBackground
|
|
1025
|
+
});
|
|
1026
|
+
const layout = () => {
|
|
1027
|
+
scrollableContent.scanDomNode();
|
|
1028
|
+
const scrollDimensions = scrollableContent.getScrollDimensions();
|
|
1029
|
+
dependenciesTree.layout(scrollDimensions.height);
|
|
1030
|
+
};
|
|
1031
|
+
const removeLayoutParticipant = arrays.insert(this.layoutParticipants, { layout });
|
|
1032
|
+
this.contentDisposables.add(toDisposable(removeLayoutParticipant));
|
|
1033
|
+
this.contentDisposables.add(dependenciesTree);
|
|
1034
|
+
scrollableContent.scanDomNode();
|
|
1035
|
+
return Promise.resolve({ focus() { dependenciesTree.domFocus(); } });
|
|
1036
|
+
}
|
|
1037
|
+
async openExtensionPack(extension, template, token) {
|
|
1038
|
+
if (token.isCancellationRequested) {
|
|
1039
|
+
return Promise.resolve(null);
|
|
1040
|
+
}
|
|
1041
|
+
const manifest = await this.loadContents(() => this.extensionManifest.get(), template.content);
|
|
1042
|
+
if (token.isCancellationRequested) {
|
|
1043
|
+
return null;
|
|
1044
|
+
}
|
|
1045
|
+
if (!manifest) {
|
|
1046
|
+
return null;
|
|
1047
|
+
}
|
|
1048
|
+
return this.renderExtensionPack(manifest, template.content, token);
|
|
1049
|
+
}
|
|
1050
|
+
async openRuntimeStatus(extension, template, token) {
|
|
1051
|
+
const content = $('div', { class: 'subcontent', tabindex: '0' });
|
|
1052
|
+
const scrollableContent = ( new DomScrollableElement(content, {}));
|
|
1053
|
+
const layout = () => scrollableContent.scanDomNode();
|
|
1054
|
+
const removeLayoutParticipant = arrays.insert(this.layoutParticipants, { layout });
|
|
1055
|
+
this.contentDisposables.add(toDisposable(removeLayoutParticipant));
|
|
1056
|
+
const updateContent = () => {
|
|
1057
|
+
scrollableContent.scanDomNode();
|
|
1058
|
+
reset(content, this.renderRuntimeStatus(extension, layout));
|
|
1059
|
+
};
|
|
1060
|
+
updateContent();
|
|
1061
|
+
this.extensionService.onDidChangeExtensionsStatus(e => {
|
|
1062
|
+
if (( e.some(
|
|
1063
|
+
extensionIdentifier => areSameExtensions({ id: extensionIdentifier.value }, extension.identifier)
|
|
1064
|
+
))) {
|
|
1065
|
+
updateContent();
|
|
1066
|
+
}
|
|
1067
|
+
}, this, this.contentDisposables);
|
|
1068
|
+
this.contentDisposables.add(scrollableContent);
|
|
1069
|
+
append(template.content, scrollableContent.getDomNode());
|
|
1070
|
+
return content;
|
|
1071
|
+
}
|
|
1072
|
+
renderRuntimeStatus(extension, onDetailsToggle) {
|
|
1073
|
+
const extensionStatus = this.extensionsWorkbenchService.getExtensionStatus(extension);
|
|
1074
|
+
const element = $('.runtime-status');
|
|
1075
|
+
if (extensionStatus?.activationTimes) {
|
|
1076
|
+
const activationTime = extensionStatus.activationTimes.codeLoadingTime + extensionStatus.activationTimes.activateCallTime;
|
|
1077
|
+
const activationElement = append(element, $('div.activation-details'));
|
|
1078
|
+
const activationReasonElement = append(activationElement, $('div.activation-element-entry'));
|
|
1079
|
+
append(activationReasonElement, $('span.activation-message-title', undefined, ( localizeWithPath(
|
|
1080
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1081
|
+
'activation reason',
|
|
1082
|
+
"Activation Event:"
|
|
1083
|
+
))));
|
|
1084
|
+
append(activationReasonElement, $('code', undefined, extensionStatus.activationTimes.activationReason.startup ? ( localizeWithPath(
|
|
1085
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1086
|
+
'startup',
|
|
1087
|
+
"Startup"
|
|
1088
|
+
)) : extensionStatus.activationTimes.activationReason.activationEvent));
|
|
1089
|
+
const activationTimeElement = append(activationElement, $('div.activation-element-entry'));
|
|
1090
|
+
append(activationTimeElement, $('span.activation-message-title', undefined, ( localizeWithPath(
|
|
1091
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1092
|
+
'activation time',
|
|
1093
|
+
"Activation Time:"
|
|
1094
|
+
))));
|
|
1095
|
+
append(activationTimeElement, $('code', undefined, `${activationTime}ms`));
|
|
1096
|
+
if (ExtensionIdentifier.toKey(extensionStatus.activationTimes.activationReason.extensionId) !== ExtensionIdentifier.toKey(extension.identifier.id)) {
|
|
1097
|
+
const activatedByElement = append(activationElement, $('div.activation-element-entry'));
|
|
1098
|
+
append(activatedByElement, $('span.activation-message-title', undefined, ( localizeWithPath(
|
|
1099
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1100
|
+
'activatedBy',
|
|
1101
|
+
"Activated By:"
|
|
1102
|
+
))));
|
|
1103
|
+
append(activatedByElement, $('span', undefined, extensionStatus.activationTimes.activationReason.extensionId.value));
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
else if (extension.local && (extension.local.manifest.main || extension.local.manifest.browser)) {
|
|
1107
|
+
append(element, $('div.activation-message', undefined, ( localizeWithPath(
|
|
1108
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1109
|
+
'not yet activated',
|
|
1110
|
+
"Not yet activated."
|
|
1111
|
+
))));
|
|
1112
|
+
}
|
|
1113
|
+
if (extensionStatus?.runtimeErrors.length) {
|
|
1114
|
+
append(element, $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1115
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1116
|
+
'uncaught errors',
|
|
1117
|
+
"Uncaught Errors ({0})",
|
|
1118
|
+
extensionStatus.runtimeErrors.length
|
|
1119
|
+
))), $('div', undefined, ...( extensionStatus.runtimeErrors.map(
|
|
1120
|
+
error => $('div.message-entry', undefined, $(`span${ThemeIcon.asCSSSelector(errorIcon)}`, undefined), $('span', undefined, getErrorMessage(error)))
|
|
1121
|
+
)))));
|
|
1122
|
+
}
|
|
1123
|
+
if (extensionStatus?.messages.length) {
|
|
1124
|
+
append(element, $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1125
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1126
|
+
'messages',
|
|
1127
|
+
"Messages ({0})",
|
|
1128
|
+
extensionStatus?.messages.length
|
|
1129
|
+
))), $('div', undefined, ...( extensionStatus.messages.sort((a, b) => b.type - a.type)
|
|
1130
|
+
.map(
|
|
1131
|
+
message => $('div.message-entry', undefined, $(`span${ThemeIcon.asCSSSelector(message.type === Severity.Error ? errorIcon : message.type === Severity.Warning ? warningIcon : infoIcon)}`, undefined), $('span', undefined, message.message))
|
|
1132
|
+
)))));
|
|
1133
|
+
}
|
|
1134
|
+
if (element.children.length === 0) {
|
|
1135
|
+
append(element, $('div.no-status-message')).textContent = ( localizeWithPath(
|
|
1136
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1137
|
+
'noStatus',
|
|
1138
|
+
"No status available."
|
|
1139
|
+
));
|
|
1140
|
+
}
|
|
1141
|
+
return element;
|
|
1142
|
+
}
|
|
1143
|
+
async renderExtensionPack(manifest, parent, token) {
|
|
1144
|
+
if (token.isCancellationRequested) {
|
|
1145
|
+
return null;
|
|
1146
|
+
}
|
|
1147
|
+
const content = $('div', { class: 'subcontent' });
|
|
1148
|
+
const scrollableContent = ( new DomScrollableElement(content, { useShadows: false }));
|
|
1149
|
+
append(parent, scrollableContent.getDomNode());
|
|
1150
|
+
const extensionsGridView = this.instantiationService.createInstance(ExtensionsGridView, content, ( new Delegate()));
|
|
1151
|
+
const extensions = await getExtensions(manifest.extensionPack, this.extensionsWorkbenchService);
|
|
1152
|
+
extensionsGridView.setExtensions(extensions);
|
|
1153
|
+
scrollableContent.scanDomNode();
|
|
1154
|
+
this.contentDisposables.add(scrollableContent);
|
|
1155
|
+
this.contentDisposables.add(extensionsGridView);
|
|
1156
|
+
this.contentDisposables.add(toDisposable(arrays.insert(this.layoutParticipants, { layout: () => scrollableContent.scanDomNode() })));
|
|
1157
|
+
return content;
|
|
1158
|
+
}
|
|
1159
|
+
renderSettings(container, manifest, onDetailsToggle) {
|
|
1160
|
+
const configuration = manifest.contributes?.configuration;
|
|
1161
|
+
let properties = {};
|
|
1162
|
+
if (Array.isArray(configuration)) {
|
|
1163
|
+
configuration.forEach(config => {
|
|
1164
|
+
properties = { ...properties, ...config.properties };
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
else if (configuration) {
|
|
1168
|
+
properties = configuration.properties;
|
|
1169
|
+
}
|
|
1170
|
+
let contrib = properties ? ( Object.keys(properties)) : [];
|
|
1171
|
+
contrib = contrib.filter(key => {
|
|
1172
|
+
const config = properties[key];
|
|
1173
|
+
return !config.deprecationMessage && !config.markdownDeprecationMessage;
|
|
1174
|
+
});
|
|
1175
|
+
if (!contrib.length) {
|
|
1176
|
+
return false;
|
|
1177
|
+
}
|
|
1178
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1179
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1180
|
+
'settings',
|
|
1181
|
+
"Settings ({0})",
|
|
1182
|
+
contrib.length
|
|
1183
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath(
|
|
1184
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1185
|
+
'setting name',
|
|
1186
|
+
"ID"
|
|
1187
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1188
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1189
|
+
'description',
|
|
1190
|
+
"Description"
|
|
1191
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1192
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1193
|
+
'default',
|
|
1194
|
+
"Default"
|
|
1195
|
+
)))), ...( contrib.map(key => {
|
|
1196
|
+
let description = properties[key].description || '';
|
|
1197
|
+
if (properties[key].markdownDescription) {
|
|
1198
|
+
const { element, dispose } = renderMarkdown({ value: properties[key].markdownDescription }, { actionHandler: { callback: (content) => this.openerService.open(content).catch(onUnexpectedError), disposables: this.contentDisposables } });
|
|
1199
|
+
description = element;
|
|
1200
|
+
this.contentDisposables.add(toDisposable(dispose));
|
|
1201
|
+
}
|
|
1202
|
+
return $('tr', undefined, $('td', undefined, $('code', undefined, key)), $('td', undefined, description), $('td', undefined, $('code', undefined, `${isUndefined(properties[key].default) ? getDefaultValue(properties[key].type) : properties[key].default}`)));
|
|
1203
|
+
}))));
|
|
1204
|
+
append(container, details);
|
|
1205
|
+
return true;
|
|
1206
|
+
}
|
|
1207
|
+
renderDebuggers(container, manifest, onDetailsToggle) {
|
|
1208
|
+
const contrib = manifest.contributes?.debuggers || [];
|
|
1209
|
+
if (!contrib.length) {
|
|
1210
|
+
return false;
|
|
1211
|
+
}
|
|
1212
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1213
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1214
|
+
'debuggers',
|
|
1215
|
+
"Debuggers ({0})",
|
|
1216
|
+
contrib.length
|
|
1217
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath(
|
|
1218
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1219
|
+
'debugger name',
|
|
1220
|
+
"Name"
|
|
1221
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1222
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1223
|
+
'debugger type',
|
|
1224
|
+
"Type"
|
|
1225
|
+
)))), ...( contrib.map(
|
|
1226
|
+
d => $('tr', undefined, $('td', undefined, d.label), $('td', undefined, d.type))
|
|
1227
|
+
))));
|
|
1228
|
+
append(container, details);
|
|
1229
|
+
return true;
|
|
1230
|
+
}
|
|
1231
|
+
renderViewContainers(container, manifest, onDetailsToggle) {
|
|
1232
|
+
const contrib = manifest.contributes?.viewsContainers || {};
|
|
1233
|
+
const viewContainers = ( Object.keys(contrib)).reduce((result, location) => {
|
|
1234
|
+
const viewContainersForLocation = contrib[location];
|
|
1235
|
+
result.push(...( viewContainersForLocation.map(viewContainer => ({ ...viewContainer, location }))));
|
|
1236
|
+
return result;
|
|
1237
|
+
}, []);
|
|
1238
|
+
if (!viewContainers.length) {
|
|
1239
|
+
return false;
|
|
1240
|
+
}
|
|
1241
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1242
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1243
|
+
'viewContainers',
|
|
1244
|
+
"View Containers ({0})",
|
|
1245
|
+
viewContainers.length
|
|
1246
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath(
|
|
1247
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1248
|
+
'view container id',
|
|
1249
|
+
"ID"
|
|
1250
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1251
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1252
|
+
'view container title',
|
|
1253
|
+
"Title"
|
|
1254
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1255
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1256
|
+
'view container location',
|
|
1257
|
+
"Where"
|
|
1258
|
+
)))), ...( viewContainers.map(
|
|
1259
|
+
viewContainer => $('tr', undefined, $('td', undefined, viewContainer.id), $('td', undefined, viewContainer.title), $('td', undefined, viewContainer.location))
|
|
1260
|
+
))));
|
|
1261
|
+
append(container, details);
|
|
1262
|
+
return true;
|
|
1263
|
+
}
|
|
1264
|
+
renderViews(container, manifest, onDetailsToggle) {
|
|
1265
|
+
const contrib = manifest.contributes?.views || {};
|
|
1266
|
+
const views = ( Object.keys(contrib)).reduce((result, location) => {
|
|
1267
|
+
const viewsForLocation = contrib[location];
|
|
1268
|
+
result.push(...( viewsForLocation.map(view => ({ ...view, location }))));
|
|
1269
|
+
return result;
|
|
1270
|
+
}, []);
|
|
1271
|
+
if (!views.length) {
|
|
1272
|
+
return false;
|
|
1273
|
+
}
|
|
1274
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1275
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1276
|
+
'views',
|
|
1277
|
+
"Views ({0})",
|
|
1278
|
+
views.length
|
|
1279
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath('vs/workbench/contrib/extensions/browser/extensionEditor', 'view id', "ID"))), $('th', undefined, ( localizeWithPath(
|
|
1280
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1281
|
+
'view name',
|
|
1282
|
+
"Name"
|
|
1283
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1284
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1285
|
+
'view location',
|
|
1286
|
+
"Where"
|
|
1287
|
+
)))), ...( views.map(
|
|
1288
|
+
view => $('tr', undefined, $('td', undefined, view.id), $('td', undefined, view.name), $('td', undefined, view.location))
|
|
1289
|
+
))));
|
|
1290
|
+
append(container, details);
|
|
1291
|
+
return true;
|
|
1292
|
+
}
|
|
1293
|
+
renderLocalizations(container, manifest, onDetailsToggle) {
|
|
1294
|
+
const localizations = manifest.contributes?.localizations || [];
|
|
1295
|
+
if (!localizations.length) {
|
|
1296
|
+
return false;
|
|
1297
|
+
}
|
|
1298
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1299
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1300
|
+
'localizations',
|
|
1301
|
+
"Localizations ({0})",
|
|
1302
|
+
localizations.length
|
|
1303
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath(
|
|
1304
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1305
|
+
'localizations language id',
|
|
1306
|
+
"Language ID"
|
|
1307
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1308
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1309
|
+
'localizations language name',
|
|
1310
|
+
"Language Name"
|
|
1311
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1312
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1313
|
+
'localizations localized language name',
|
|
1314
|
+
"Language Name (Localized)"
|
|
1315
|
+
)))), ...( localizations.map(
|
|
1316
|
+
localization => $('tr', undefined, $('td', undefined, localization.languageId), $('td', undefined, localization.languageName || ''), $('td', undefined, localization.localizedLanguageName || ''))
|
|
1317
|
+
))));
|
|
1318
|
+
append(container, details);
|
|
1319
|
+
return true;
|
|
1320
|
+
}
|
|
1321
|
+
renderCustomEditors(container, manifest, onDetailsToggle) {
|
|
1322
|
+
const webviewEditors = manifest.contributes?.customEditors || [];
|
|
1323
|
+
if (!webviewEditors.length) {
|
|
1324
|
+
return false;
|
|
1325
|
+
}
|
|
1326
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1327
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1328
|
+
'customEditors',
|
|
1329
|
+
"Custom Editors ({0})",
|
|
1330
|
+
webviewEditors.length
|
|
1331
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath(
|
|
1332
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1333
|
+
'customEditors view type',
|
|
1334
|
+
"View Type"
|
|
1335
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1336
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1337
|
+
'customEditors priority',
|
|
1338
|
+
"Priority"
|
|
1339
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1340
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1341
|
+
'customEditors filenamePattern',
|
|
1342
|
+
"Filename Pattern"
|
|
1343
|
+
)))), ...( webviewEditors.map(
|
|
1344
|
+
webviewEditor => $('tr', undefined, $('td', undefined, webviewEditor.viewType), $('td', undefined, webviewEditor.priority), $('td', undefined, arrays.coalesce(( webviewEditor.selector.map(x => x.filenamePattern))).join(', ')))
|
|
1345
|
+
))));
|
|
1346
|
+
append(container, details);
|
|
1347
|
+
return true;
|
|
1348
|
+
}
|
|
1349
|
+
renderCodeActions(container, manifest, onDetailsToggle) {
|
|
1350
|
+
const codeActions = manifest.contributes?.codeActions || [];
|
|
1351
|
+
if (!codeActions.length) {
|
|
1352
|
+
return false;
|
|
1353
|
+
}
|
|
1354
|
+
const flatActions = arrays.flatten(( codeActions.map(contribution => ( contribution.actions.map(action => ({ ...action, languages: contribution.languages }))))));
|
|
1355
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1356
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1357
|
+
'codeActions',
|
|
1358
|
+
"Code Actions ({0})",
|
|
1359
|
+
flatActions.length
|
|
1360
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath(
|
|
1361
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1362
|
+
'codeActions.title',
|
|
1363
|
+
"Title"
|
|
1364
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1365
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1366
|
+
'codeActions.kind',
|
|
1367
|
+
"Kind"
|
|
1368
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1369
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1370
|
+
'codeActions.description',
|
|
1371
|
+
"Description"
|
|
1372
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1373
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1374
|
+
'codeActions.languages',
|
|
1375
|
+
"Languages"
|
|
1376
|
+
)))), ...( flatActions.map(
|
|
1377
|
+
action => $('tr', undefined, $('td', undefined, action.title), $('td', undefined, $('code', undefined, action.kind)), $('td', undefined, action.description ?? ''), $('td', undefined, ...( action.languages.map(language => $('code', undefined, language)))))
|
|
1378
|
+
))));
|
|
1379
|
+
append(container, details);
|
|
1380
|
+
return true;
|
|
1381
|
+
}
|
|
1382
|
+
renderAuthentication(container, manifest, onDetailsToggle) {
|
|
1383
|
+
const authentication = manifest.contributes?.authentication || [];
|
|
1384
|
+
if (!authentication.length) {
|
|
1385
|
+
return false;
|
|
1386
|
+
}
|
|
1387
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1388
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1389
|
+
'authentication',
|
|
1390
|
+
"Authentication ({0})",
|
|
1391
|
+
authentication.length
|
|
1392
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath(
|
|
1393
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1394
|
+
'authentication.label',
|
|
1395
|
+
"Label"
|
|
1396
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1397
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1398
|
+
'authentication.id',
|
|
1399
|
+
"ID"
|
|
1400
|
+
)))), ...( authentication.map(
|
|
1401
|
+
action => $('tr', undefined, $('td', undefined, action.label), $('td', undefined, action.id))
|
|
1402
|
+
))));
|
|
1403
|
+
append(container, details);
|
|
1404
|
+
return true;
|
|
1405
|
+
}
|
|
1406
|
+
renderColorThemes(container, manifest, onDetailsToggle) {
|
|
1407
|
+
const contrib = manifest.contributes?.themes || [];
|
|
1408
|
+
if (!contrib.length) {
|
|
1409
|
+
return false;
|
|
1410
|
+
}
|
|
1411
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1412
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1413
|
+
'colorThemes',
|
|
1414
|
+
"Color Themes ({0})",
|
|
1415
|
+
contrib.length
|
|
1416
|
+
))), $('ul', undefined, ...( contrib.map(theme => $('li', undefined, theme.label)))));
|
|
1417
|
+
append(container, details);
|
|
1418
|
+
return true;
|
|
1419
|
+
}
|
|
1420
|
+
renderIconThemes(container, manifest, onDetailsToggle) {
|
|
1421
|
+
const contrib = manifest.contributes?.iconThemes || [];
|
|
1422
|
+
if (!contrib.length) {
|
|
1423
|
+
return false;
|
|
1424
|
+
}
|
|
1425
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1426
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1427
|
+
'iconThemes',
|
|
1428
|
+
"File Icon Themes ({0})",
|
|
1429
|
+
contrib.length
|
|
1430
|
+
))), $('ul', undefined, ...( contrib.map(theme => $('li', undefined, theme.label)))));
|
|
1431
|
+
append(container, details);
|
|
1432
|
+
return true;
|
|
1433
|
+
}
|
|
1434
|
+
renderProductIconThemes(container, manifest, onDetailsToggle) {
|
|
1435
|
+
const contrib = manifest.contributes?.productIconThemes || [];
|
|
1436
|
+
if (!contrib.length) {
|
|
1437
|
+
return false;
|
|
1438
|
+
}
|
|
1439
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1440
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1441
|
+
'productThemes',
|
|
1442
|
+
"Product Icon Themes ({0})",
|
|
1443
|
+
contrib.length
|
|
1444
|
+
))), $('ul', undefined, ...( contrib.map(theme => $('li', undefined, theme.label)))));
|
|
1445
|
+
append(container, details);
|
|
1446
|
+
return true;
|
|
1447
|
+
}
|
|
1448
|
+
renderColors(container, manifest, onDetailsToggle) {
|
|
1449
|
+
const colors = manifest.contributes?.colors || [];
|
|
1450
|
+
if (!colors.length) {
|
|
1451
|
+
return false;
|
|
1452
|
+
}
|
|
1453
|
+
function colorPreview(colorReference) {
|
|
1454
|
+
const result = [];
|
|
1455
|
+
if (colorReference && colorReference[0] === '#') {
|
|
1456
|
+
const color = ( Color.fromHex(colorReference));
|
|
1457
|
+
if (color) {
|
|
1458
|
+
result.push($('span', { class: 'colorBox', style: 'background-color: ' + Color.Format.CSS.format(color) }, ''));
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
result.push($('code', undefined, colorReference));
|
|
1462
|
+
return result;
|
|
1463
|
+
}
|
|
1464
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1465
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1466
|
+
'colors',
|
|
1467
|
+
"Colors ({0})",
|
|
1468
|
+
colors.length
|
|
1469
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath('vs/workbench/contrib/extensions/browser/extensionEditor', 'colorId', "ID"))), $('th', undefined, ( localizeWithPath(
|
|
1470
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1471
|
+
'description',
|
|
1472
|
+
"Description"
|
|
1473
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1474
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1475
|
+
'defaultDark',
|
|
1476
|
+
"Dark Default"
|
|
1477
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1478
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1479
|
+
'defaultLight',
|
|
1480
|
+
"Light Default"
|
|
1481
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1482
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1483
|
+
'defaultHC',
|
|
1484
|
+
"High Contrast Default"
|
|
1485
|
+
)))), ...( colors.map(
|
|
1486
|
+
color => $('tr', undefined, $('td', undefined, $('code', undefined, color.id)), $('td', undefined, color.description), $('td', undefined, ...colorPreview(color.defaults.dark)), $('td', undefined, ...colorPreview(color.defaults.light)), $('td', undefined, ...colorPreview(color.defaults.highContrast)))
|
|
1487
|
+
))));
|
|
1488
|
+
append(container, details);
|
|
1489
|
+
return true;
|
|
1490
|
+
}
|
|
1491
|
+
renderJSONValidation(container, manifest, onDetailsToggle) {
|
|
1492
|
+
const contrib = manifest.contributes?.jsonValidation || [];
|
|
1493
|
+
if (!contrib.length) {
|
|
1494
|
+
return false;
|
|
1495
|
+
}
|
|
1496
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1497
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1498
|
+
'JSON Validation',
|
|
1499
|
+
"JSON Validation ({0})",
|
|
1500
|
+
contrib.length
|
|
1501
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath(
|
|
1502
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1503
|
+
'fileMatch',
|
|
1504
|
+
"File Match"
|
|
1505
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1506
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1507
|
+
'schema',
|
|
1508
|
+
"Schema"
|
|
1509
|
+
)))), ...( contrib.map(
|
|
1510
|
+
v => $('tr', undefined, $('td', undefined, $('code', undefined, Array.isArray(v.fileMatch) ? v.fileMatch.join(', ') : v.fileMatch)), $('td', undefined, v.url))
|
|
1511
|
+
))));
|
|
1512
|
+
append(container, details);
|
|
1513
|
+
return true;
|
|
1514
|
+
}
|
|
1515
|
+
renderCommands(container, manifest, onDetailsToggle) {
|
|
1516
|
+
const rawCommands = manifest.contributes?.commands || [];
|
|
1517
|
+
const commands = ( rawCommands.map(c => ({
|
|
1518
|
+
id: c.command,
|
|
1519
|
+
title: c.title,
|
|
1520
|
+
keybindings: [],
|
|
1521
|
+
menus: []
|
|
1522
|
+
})));
|
|
1523
|
+
const byId = arrays.index(commands, c => c.id);
|
|
1524
|
+
const menus = manifest.contributes?.menus || {};
|
|
1525
|
+
for (const context in menus) {
|
|
1526
|
+
for (const menu of menus[context]) {
|
|
1527
|
+
if (menu.command) {
|
|
1528
|
+
let command = byId[menu.command];
|
|
1529
|
+
if (command) {
|
|
1530
|
+
command.menus.push(context);
|
|
1531
|
+
}
|
|
1532
|
+
else {
|
|
1533
|
+
command = { id: menu.command, title: '', keybindings: [], menus: [context] };
|
|
1534
|
+
byId[command.id] = command;
|
|
1535
|
+
commands.push(command);
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
const rawKeybindings = manifest.contributes?.keybindings ? (Array.isArray(manifest.contributes.keybindings) ? manifest.contributes.keybindings : [manifest.contributes.keybindings]) : [];
|
|
1541
|
+
rawKeybindings.forEach(rawKeybinding => {
|
|
1542
|
+
const keybinding = this.resolveKeybinding(rawKeybinding);
|
|
1543
|
+
if (!keybinding) {
|
|
1544
|
+
return;
|
|
1545
|
+
}
|
|
1546
|
+
let command = byId[rawKeybinding.command];
|
|
1547
|
+
if (command) {
|
|
1548
|
+
command.keybindings.push(keybinding);
|
|
1549
|
+
}
|
|
1550
|
+
else {
|
|
1551
|
+
command = { id: rawKeybinding.command, title: '', keybindings: [keybinding], menus: [] };
|
|
1552
|
+
byId[command.id] = command;
|
|
1553
|
+
commands.push(command);
|
|
1554
|
+
}
|
|
1555
|
+
});
|
|
1556
|
+
if (!commands.length) {
|
|
1557
|
+
return false;
|
|
1558
|
+
}
|
|
1559
|
+
const renderKeybinding = (keybinding) => {
|
|
1560
|
+
const element = $('');
|
|
1561
|
+
const kbl = ( new KeybindingLabel(element, OS, defaultKeybindingLabelStyles));
|
|
1562
|
+
kbl.set(keybinding);
|
|
1563
|
+
return element;
|
|
1564
|
+
};
|
|
1565
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1566
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1567
|
+
'commands',
|
|
1568
|
+
"Commands ({0})",
|
|
1569
|
+
commands.length
|
|
1570
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath(
|
|
1571
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1572
|
+
'command name',
|
|
1573
|
+
"ID"
|
|
1574
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1575
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1576
|
+
'command title',
|
|
1577
|
+
"Title"
|
|
1578
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1579
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1580
|
+
'keyboard shortcuts',
|
|
1581
|
+
"Keyboard Shortcuts"
|
|
1582
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1583
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1584
|
+
'menuContexts',
|
|
1585
|
+
"Menu Contexts"
|
|
1586
|
+
)))), ...( commands.map(
|
|
1587
|
+
c => $('tr', undefined, $('td', undefined, $('code', undefined, c.id)), $('td', undefined, typeof c.title === 'string' ? c.title : c.title.value), $('td', undefined, ...( c.keybindings.map(keybinding => renderKeybinding(keybinding)))), $('td', undefined, ...( c.menus.map(context => $('code', undefined, context)))))
|
|
1588
|
+
))));
|
|
1589
|
+
append(container, details);
|
|
1590
|
+
return true;
|
|
1591
|
+
}
|
|
1592
|
+
renderLanguages(container, manifest, onDetailsToggle) {
|
|
1593
|
+
const contributes = manifest.contributes;
|
|
1594
|
+
const rawLanguages = contributes?.languages || [];
|
|
1595
|
+
const languages = ( rawLanguages.map(l => ({
|
|
1596
|
+
id: l.id,
|
|
1597
|
+
name: (l.aliases || [])[0] || l.id,
|
|
1598
|
+
extensions: l.extensions || [],
|
|
1599
|
+
hasGrammar: false,
|
|
1600
|
+
hasSnippets: false
|
|
1601
|
+
})));
|
|
1602
|
+
const byId = arrays.index(languages, l => l.id);
|
|
1603
|
+
const grammars = contributes?.grammars || [];
|
|
1604
|
+
grammars.forEach(grammar => {
|
|
1605
|
+
let language = byId[grammar.language];
|
|
1606
|
+
if (language) {
|
|
1607
|
+
language.hasGrammar = true;
|
|
1608
|
+
}
|
|
1609
|
+
else {
|
|
1610
|
+
language = { id: grammar.language, name: grammar.language, extensions: [], hasGrammar: true, hasSnippets: false };
|
|
1611
|
+
byId[language.id] = language;
|
|
1612
|
+
languages.push(language);
|
|
1613
|
+
}
|
|
1614
|
+
});
|
|
1615
|
+
const snippets = contributes?.snippets || [];
|
|
1616
|
+
snippets.forEach(snippet => {
|
|
1617
|
+
let language = byId[snippet.language];
|
|
1618
|
+
if (language) {
|
|
1619
|
+
language.hasSnippets = true;
|
|
1620
|
+
}
|
|
1621
|
+
else {
|
|
1622
|
+
language = { id: snippet.language, name: snippet.language, extensions: [], hasGrammar: false, hasSnippets: true };
|
|
1623
|
+
byId[language.id] = language;
|
|
1624
|
+
languages.push(language);
|
|
1625
|
+
}
|
|
1626
|
+
});
|
|
1627
|
+
if (!languages.length) {
|
|
1628
|
+
return false;
|
|
1629
|
+
}
|
|
1630
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1631
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1632
|
+
'languages',
|
|
1633
|
+
"Languages ({0})",
|
|
1634
|
+
languages.length
|
|
1635
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath(
|
|
1636
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1637
|
+
'language id',
|
|
1638
|
+
"ID"
|
|
1639
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1640
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1641
|
+
'language name',
|
|
1642
|
+
"Name"
|
|
1643
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1644
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1645
|
+
'file extensions',
|
|
1646
|
+
"File Extensions"
|
|
1647
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1648
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1649
|
+
'grammar',
|
|
1650
|
+
"Grammar"
|
|
1651
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1652
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1653
|
+
'snippets',
|
|
1654
|
+
"Snippets"
|
|
1655
|
+
)))), ...( languages.map(
|
|
1656
|
+
l => $('tr', undefined, $('td', undefined, l.id), $('td', undefined, l.name), $('td', undefined, ...join(( l.extensions.map(ext => $('code', undefined, ext))), ' ')), $('td', undefined, document.createTextNode(l.hasGrammar ? '✔︎' : '\u2014')), $('td', undefined, document.createTextNode(l.hasSnippets ? '✔︎' : '\u2014')))
|
|
1657
|
+
))));
|
|
1658
|
+
append(container, details);
|
|
1659
|
+
return true;
|
|
1660
|
+
}
|
|
1661
|
+
renderActivationEvents(container, manifest, onDetailsToggle) {
|
|
1662
|
+
const activationEvents = manifest.activationEvents || [];
|
|
1663
|
+
if (!activationEvents.length) {
|
|
1664
|
+
return false;
|
|
1665
|
+
}
|
|
1666
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1667
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1668
|
+
'activation events',
|
|
1669
|
+
"Activation Events ({0})",
|
|
1670
|
+
activationEvents.length
|
|
1671
|
+
))), $('ul', undefined, ...( activationEvents.map(
|
|
1672
|
+
activationEvent => $('li', undefined, $('code', undefined, activationEvent))
|
|
1673
|
+
))));
|
|
1674
|
+
append(container, details);
|
|
1675
|
+
return true;
|
|
1676
|
+
}
|
|
1677
|
+
renderNotebooks(container, manifest, onDetailsToggle) {
|
|
1678
|
+
const contrib = manifest.contributes?.notebooks || [];
|
|
1679
|
+
if (!contrib.length) {
|
|
1680
|
+
return false;
|
|
1681
|
+
}
|
|
1682
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1683
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1684
|
+
'Notebooks',
|
|
1685
|
+
"Notebooks ({0})",
|
|
1686
|
+
contrib.length
|
|
1687
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath(
|
|
1688
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1689
|
+
'Notebook id',
|
|
1690
|
+
"ID"
|
|
1691
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1692
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1693
|
+
'Notebook name',
|
|
1694
|
+
"Name"
|
|
1695
|
+
)))), ...( contrib.map(
|
|
1696
|
+
d => $('tr', undefined, $('td', undefined, d.type), $('td', undefined, d.displayName))
|
|
1697
|
+
))));
|
|
1698
|
+
append(container, details);
|
|
1699
|
+
return true;
|
|
1700
|
+
}
|
|
1701
|
+
renderNotebookRenderers(container, manifest, onDetailsToggle) {
|
|
1702
|
+
const contrib = manifest.contributes?.notebookRenderer || [];
|
|
1703
|
+
if (!contrib.length) {
|
|
1704
|
+
return false;
|
|
1705
|
+
}
|
|
1706
|
+
const details = $('details', { open: true, ontoggle: onDetailsToggle }, $('summary', { tabindex: '0' }, ( localizeWithPath(
|
|
1707
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1708
|
+
'NotebookRenderers',
|
|
1709
|
+
"Notebook Renderers ({0})",
|
|
1710
|
+
contrib.length
|
|
1711
|
+
))), $('table', undefined, $('tr', undefined, $('th', undefined, ( localizeWithPath(
|
|
1712
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1713
|
+
'Notebook renderer name',
|
|
1714
|
+
"Name"
|
|
1715
|
+
))), $('th', undefined, ( localizeWithPath(
|
|
1716
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1717
|
+
'Notebook mimetypes',
|
|
1718
|
+
"Mimetypes"
|
|
1719
|
+
)))), ...( contrib.map(
|
|
1720
|
+
d => $('tr', undefined, $('td', undefined, d.displayName), $('td', undefined, d.mimeTypes.join(',')))
|
|
1721
|
+
))));
|
|
1722
|
+
append(container, details);
|
|
1723
|
+
return true;
|
|
1724
|
+
}
|
|
1725
|
+
resolveKeybinding(rawKeyBinding) {
|
|
1726
|
+
let key;
|
|
1727
|
+
switch (platform) {
|
|
1728
|
+
case 'win32':
|
|
1729
|
+
key = rawKeyBinding.win;
|
|
1730
|
+
break;
|
|
1731
|
+
case 'linux':
|
|
1732
|
+
key = rawKeyBinding.linux;
|
|
1733
|
+
break;
|
|
1734
|
+
case 'darwin':
|
|
1735
|
+
key = rawKeyBinding.mac;
|
|
1736
|
+
break;
|
|
1737
|
+
}
|
|
1738
|
+
return this.keybindingService.resolveUserBinding(key || rawKeyBinding.key)[0];
|
|
1739
|
+
}
|
|
1740
|
+
loadContents(loadingTask, container) {
|
|
1741
|
+
container.classList.add('loading');
|
|
1742
|
+
const result = this.contentDisposables.add(loadingTask());
|
|
1743
|
+
const onDone = () => container.classList.remove('loading');
|
|
1744
|
+
result.promise.then(onDone, onDone);
|
|
1745
|
+
return result.promise;
|
|
1746
|
+
}
|
|
1747
|
+
layout(dimension) {
|
|
1748
|
+
this.dimension = dimension;
|
|
1749
|
+
this.layoutParticipants.forEach(p => p.layout());
|
|
1750
|
+
}
|
|
1751
|
+
onError(err) {
|
|
1752
|
+
if (isCancellationError(err)) {
|
|
1753
|
+
return;
|
|
1754
|
+
}
|
|
1755
|
+
this.notificationService.error(err);
|
|
1756
|
+
}
|
|
1757
|
+
};
|
|
1758
|
+
ExtensionEditor = ExtensionEditor_1 = ( __decorate([
|
|
1759
|
+
( __param(0, ITelemetryService)),
|
|
1760
|
+
( __param(1, IInstantiationService)),
|
|
1761
|
+
( __param(2, IPaneCompositePartService)),
|
|
1762
|
+
( __param(3, IExtensionsWorkbenchService)),
|
|
1763
|
+
( __param(4, IExtensionGalleryService)),
|
|
1764
|
+
( __param(5, IThemeService)),
|
|
1765
|
+
( __param(6, IKeybindingService)),
|
|
1766
|
+
( __param(7, INotificationService)),
|
|
1767
|
+
( __param(8, IOpenerService)),
|
|
1768
|
+
( __param(9, IExtensionRecommendationsService)),
|
|
1769
|
+
( __param(10, IStorageService)),
|
|
1770
|
+
( __param(11, IExtensionService)),
|
|
1771
|
+
( __param(12, IWebviewService)),
|
|
1772
|
+
( __param(13, ILanguageService)),
|
|
1773
|
+
( __param(14, IContextMenuService)),
|
|
1774
|
+
( __param(15, IContextKeyService))
|
|
1775
|
+
], ExtensionEditor));
|
|
1776
|
+
const contextKeyExpr = ( ContextKeyExpr.and(( ContextKeyExpr.equals('activeEditor', ExtensionEditor.ID)), ( EditorContextKeys.focus.toNegated())));
|
|
1777
|
+
registerAction2(class ShowExtensionEditorFindAction extends Action2 {
|
|
1778
|
+
constructor() {
|
|
1779
|
+
super({
|
|
1780
|
+
id: 'editor.action.extensioneditor.showfind',
|
|
1781
|
+
title: ( localizeWithPath('vs/workbench/contrib/extensions/browser/extensionEditor', 'find', "Find")),
|
|
1782
|
+
keybinding: {
|
|
1783
|
+
when: contextKeyExpr,
|
|
1784
|
+
weight: 100 ,
|
|
1785
|
+
primary: 2048 | 36 ,
|
|
1786
|
+
}
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
run(accessor) {
|
|
1790
|
+
const extensionEditor = getExtensionEditor(accessor);
|
|
1791
|
+
extensionEditor?.showFind();
|
|
1792
|
+
}
|
|
1793
|
+
});
|
|
1794
|
+
registerAction2(class StartExtensionEditorFindNextAction extends Action2 {
|
|
1795
|
+
constructor() {
|
|
1796
|
+
super({
|
|
1797
|
+
id: 'editor.action.extensioneditor.findNext',
|
|
1798
|
+
title: ( localizeWithPath(
|
|
1799
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1800
|
+
'find next',
|
|
1801
|
+
"Find Next"
|
|
1802
|
+
)),
|
|
1803
|
+
keybinding: {
|
|
1804
|
+
when: ( ContextKeyExpr.and(contextKeyExpr, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED)),
|
|
1805
|
+
primary: 3 ,
|
|
1806
|
+
weight: 100
|
|
1807
|
+
}
|
|
1808
|
+
});
|
|
1809
|
+
}
|
|
1810
|
+
run(accessor) {
|
|
1811
|
+
const extensionEditor = getExtensionEditor(accessor);
|
|
1812
|
+
extensionEditor?.runFindAction(false);
|
|
1813
|
+
}
|
|
1814
|
+
});
|
|
1815
|
+
registerAction2(class StartExtensionEditorFindPreviousAction extends Action2 {
|
|
1816
|
+
constructor() {
|
|
1817
|
+
super({
|
|
1818
|
+
id: 'editor.action.extensioneditor.findPrevious',
|
|
1819
|
+
title: ( localizeWithPath(
|
|
1820
|
+
'vs/workbench/contrib/extensions/browser/extensionEditor',
|
|
1821
|
+
'find previous',
|
|
1822
|
+
"Find Previous"
|
|
1823
|
+
)),
|
|
1824
|
+
keybinding: {
|
|
1825
|
+
when: ( ContextKeyExpr.and(contextKeyExpr, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED)),
|
|
1826
|
+
primary: 1024 | 3 ,
|
|
1827
|
+
weight: 100
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1831
|
+
run(accessor) {
|
|
1832
|
+
const extensionEditor = getExtensionEditor(accessor);
|
|
1833
|
+
extensionEditor?.runFindAction(true);
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1836
|
+
registerThemingParticipant((theme, collector) => {
|
|
1837
|
+
const link = theme.getColor(textLinkForeground);
|
|
1838
|
+
if (link) {
|
|
1839
|
+
collector.addRule(`.monaco-workbench .extension-editor .content .details .additional-details-container .resources-container a.resource { color: ${link}; }`);
|
|
1840
|
+
collector.addRule(`.monaco-workbench .extension-editor .content .feature-contributions a { color: ${link}; }`);
|
|
1841
|
+
}
|
|
1842
|
+
const activeLink = theme.getColor(textLinkActiveForeground);
|
|
1843
|
+
if (activeLink) {
|
|
1844
|
+
collector.addRule(`.monaco-workbench .extension-editor .content .details .additional-details-container .resources-container a.resource:hover,
|
|
1845
|
+
.monaco-workbench .extension-editor .content .details .additional-details-container .resources-container a.resource:active { color: ${activeLink}; }`);
|
|
1846
|
+
collector.addRule(`.monaco-workbench .extension-editor .content .feature-contributions a:hover,
|
|
1847
|
+
.monaco-workbench .extension-editor .content .feature-contributions a:active { color: ${activeLink}; }`);
|
|
1848
|
+
}
|
|
1849
|
+
const buttonHoverBackgroundColor = theme.getColor(buttonHoverBackground);
|
|
1850
|
+
if (buttonHoverBackgroundColor) {
|
|
1851
|
+
collector.addRule(`.monaco-workbench .extension-editor .content > .details > .additional-details-container .categories-container > .categories > .category:hover { background-color: ${buttonHoverBackgroundColor}; border-color: ${buttonHoverBackgroundColor}; }`);
|
|
1852
|
+
collector.addRule(`.monaco-workbench .extension-editor .content > .details > .additional-details-container .tags-container > .tags > .tag:hover { background-color: ${buttonHoverBackgroundColor}; border-color: ${buttonHoverBackgroundColor}; }`);
|
|
1853
|
+
}
|
|
1854
|
+
const buttonForegroundColor = theme.getColor(buttonForeground);
|
|
1855
|
+
if (buttonForegroundColor) {
|
|
1856
|
+
collector.addRule(`.monaco-workbench .extension-editor .content > .details > .additional-details-container .categories-container > .categories > .category:hover { color: ${buttonForegroundColor}; }`);
|
|
1857
|
+
collector.addRule(`.monaco-workbench .extension-editor .content > .details > .additional-details-container .tags-container > .tags > .tag:hover { color: ${buttonForegroundColor}; }`);
|
|
1858
|
+
}
|
|
1859
|
+
});
|
|
1860
|
+
function getExtensionEditor(accessor) {
|
|
1861
|
+
const activeEditorPane = accessor.get(IEditorService).activeEditorPane;
|
|
1862
|
+
if (activeEditorPane instanceof ExtensionEditor) {
|
|
1863
|
+
return activeEditorPane;
|
|
1864
|
+
}
|
|
1865
|
+
return null;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
export { ExtensionEditor };
|