@codingame/monaco-vscode-mcp-service-override 17.2.0 → 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +20 -2
- package/package.json +14 -5
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.d.ts +26 -0
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +170 -0
- package/vscode/src/vs/platform/mcp/common/mcpManagementService.d.ts +35 -0
- package/vscode/src/vs/platform/mcp/common/mcpManagementService.js +292 -0
- package/vscode/src/vs/platform/mcp/common/mcpPlatformTypes.d.ts +65 -0
- package/vscode/src/vs/platform/mcp/common/mcpPlatformTypes.js +9 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +64 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +76 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpDiscovery.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +73 -27
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.d.ts +106 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.js +423 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.d.ts +61 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +542 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +45 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.d.ts +54 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +272 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +193 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +176 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/configMcpDiscovery.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/configMcpDiscovery.js +27 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +8 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +6 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceMcpDiscoveryAdapter.js +4 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpConfigPathsService.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.js +89 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.service.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.service.js +6 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.d.ts +8 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +30 -47
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.js +206 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +110 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +256 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.d.ts +29 -13
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.js +313 -116
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +15 -17
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.d.ts +16 -7
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.js +58 -39
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +109 -46
- package/vscode/src/vs/workbench/contrib/mcp/common/uriTemplate.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/uriTemplate.js +296 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.d.ts +27 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.js +73 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.d.ts +51 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +391 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpUsageService.d.ts +27 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpUsageService.js +105 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocol.d.ts +0 -395
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocol.js +0 -14
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { append, $, clearNode, addDisposableListener, setParentFlowTo } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
4
|
+
import { ActionBar } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionbar';
|
|
5
|
+
import { getDefaultHoverDelegate } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
6
|
+
import { DomScrollableElement } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/scrollbar/scrollableElement';
|
|
7
|
+
import { Action } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
|
|
8
|
+
import { insert } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
9
|
+
import { Cache } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cache';
|
|
10
|
+
import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
11
|
+
import { isCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
12
|
+
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
13
|
+
import { Disposable, dispose, MutableDisposable, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
14
|
+
import { matchesScheme, Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
15
|
+
import { language } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
16
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
17
|
+
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
18
|
+
import { TokenizationRegistry } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
|
|
19
|
+
import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
|
|
20
|
+
import { generateTokensCSSForColorMap } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/supports/tokenization';
|
|
21
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
22
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
23
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
24
|
+
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
25
|
+
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
26
|
+
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
27
|
+
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
28
|
+
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
29
|
+
import { EditorPane } from '@codingame/monaco-vscode-dcfc2191-2da1-54c7-8fb7-e92c5d11ecef-common/vscode/vs/workbench/browser/parts/editor/editorPane';
|
|
30
|
+
import { renderMarkdownDocument, DEFAULT_MARKDOWN_STYLES } from '@codingame/monaco-vscode-cf77987b-b1b7-5359-aaf8-a259c63d9f03-common/vscode/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer';
|
|
31
|
+
import { IWebviewService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/webview/browser/webview.service';
|
|
32
|
+
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
33
|
+
import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
|
|
34
|
+
import { McpServerContainers, mcpServerIcon } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
35
|
+
import { PublisherWidget, InstallCountWidget, RatingsWidget, onClick } from './mcpServerWidgets.js';
|
|
36
|
+
import { InstallAction, UninstallAction, ManageMcpServerAction, DropDownAction } from './mcpServerActions.js';
|
|
37
|
+
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
38
|
+
|
|
39
|
+
var McpServerEditor_1;
|
|
40
|
+
var McpServerEditorTab;
|
|
41
|
+
(function (McpServerEditorTab) {
|
|
42
|
+
McpServerEditorTab["Readme"] = "readme";
|
|
43
|
+
})(McpServerEditorTab || (McpServerEditorTab = {}));
|
|
44
|
+
function toDateString(date) {
|
|
45
|
+
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}, ${date.toLocaleTimeString(language, { hourCycle: 'h23' })}`;
|
|
46
|
+
}
|
|
47
|
+
class NavBar extends Disposable {
|
|
48
|
+
get onChange() { return this._onChange.event; }
|
|
49
|
+
get currentId() { return this._currentId; }
|
|
50
|
+
constructor(container) {
|
|
51
|
+
super();
|
|
52
|
+
this._onChange = this._register(( new Emitter()));
|
|
53
|
+
this._currentId = null;
|
|
54
|
+
const element = append(container, $('.navbar'));
|
|
55
|
+
this.actions = [];
|
|
56
|
+
this.actionbar = this._register(( new ActionBar(element)));
|
|
57
|
+
}
|
|
58
|
+
push(id, label, tooltip) {
|
|
59
|
+
const action = ( new Action(id, label, undefined, true, () => this.update(id, true)));
|
|
60
|
+
action.tooltip = tooltip;
|
|
61
|
+
this.actions.push(action);
|
|
62
|
+
this.actionbar.push(action);
|
|
63
|
+
if (this.actions.length === 1) {
|
|
64
|
+
this.update(id);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
clear() {
|
|
68
|
+
this.actions = dispose(this.actions);
|
|
69
|
+
this.actionbar.clear();
|
|
70
|
+
}
|
|
71
|
+
switch(id) {
|
|
72
|
+
const action = this.actions.find(action => action.id === id);
|
|
73
|
+
if (action) {
|
|
74
|
+
action.run();
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
update(id, focus) {
|
|
80
|
+
this._currentId = id;
|
|
81
|
+
this._onChange.fire({ id, focus: !!focus });
|
|
82
|
+
this.actions.forEach(a => a.checked = a.id === id);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
var WebviewIndex;
|
|
86
|
+
(function (WebviewIndex) {
|
|
87
|
+
WebviewIndex[WebviewIndex["Readme"] = 0] = "Readme";
|
|
88
|
+
WebviewIndex[WebviewIndex["Changelog"] = 1] = "Changelog";
|
|
89
|
+
})(WebviewIndex || (WebviewIndex = {}));
|
|
90
|
+
let McpServerEditor = class McpServerEditor extends EditorPane {
|
|
91
|
+
static { McpServerEditor_1 = this; }
|
|
92
|
+
static { this.ID = 'workbench.editor.mcpServer'; }
|
|
93
|
+
constructor(group, telemetryService, instantiationService, themeService, notificationService, openerService, storageService, extensionService, webviewService, languageService, contextKeyService, hoverService) {
|
|
94
|
+
super(McpServerEditor_1.ID, group, telemetryService, themeService, storageService);
|
|
95
|
+
this.instantiationService = instantiationService;
|
|
96
|
+
this.notificationService = notificationService;
|
|
97
|
+
this.openerService = openerService;
|
|
98
|
+
this.extensionService = extensionService;
|
|
99
|
+
this.webviewService = webviewService;
|
|
100
|
+
this.languageService = languageService;
|
|
101
|
+
this.contextKeyService = contextKeyService;
|
|
102
|
+
this.hoverService = hoverService;
|
|
103
|
+
this._scopedContextKeyService = this._register(( new MutableDisposable()));
|
|
104
|
+
this.initialScrollProgress = ( new Map());
|
|
105
|
+
this.currentIdentifier = '';
|
|
106
|
+
this.layoutParticipants = [];
|
|
107
|
+
this.contentDisposables = this._register(( new DisposableStore()));
|
|
108
|
+
this.transientDisposables = this._register(( new DisposableStore()));
|
|
109
|
+
this.activeElement = null;
|
|
110
|
+
this.mcpServerReadme = null;
|
|
111
|
+
}
|
|
112
|
+
get scopedContextKeyService() {
|
|
113
|
+
return this._scopedContextKeyService.value;
|
|
114
|
+
}
|
|
115
|
+
createEditor(parent) {
|
|
116
|
+
const root = append(parent, $('.extension-editor'));
|
|
117
|
+
this._scopedContextKeyService.value = this.contextKeyService.createScoped(root);
|
|
118
|
+
this._scopedContextKeyService.value.createKey('inExtensionEditor', true);
|
|
119
|
+
root.tabIndex = 0;
|
|
120
|
+
root.style.outline = 'none';
|
|
121
|
+
root.setAttribute('role', 'document');
|
|
122
|
+
const header = append(root, $('.header'));
|
|
123
|
+
const iconContainer = append(header, $('.icon-container'));
|
|
124
|
+
const details = append(header, $('.details'));
|
|
125
|
+
const title = append(details, $('.title'));
|
|
126
|
+
const name = append(title, $('span.name.clickable', { role: 'heading', tabIndex: 0 }));
|
|
127
|
+
this._register(this.hoverService.setupManagedHover(getDefaultHoverDelegate('mouse'), name, ( localize(7899, "Extension name"))));
|
|
128
|
+
const subtitle = append(details, $('.subtitle'));
|
|
129
|
+
const subTitleEntryContainers = [];
|
|
130
|
+
const publisherContainer = append(subtitle, $('.subtitle-entry'));
|
|
131
|
+
subTitleEntryContainers.push(publisherContainer);
|
|
132
|
+
const publisherWidget = this.instantiationService.createInstance(PublisherWidget, publisherContainer, false);
|
|
133
|
+
const installCountContainer = append(subtitle, $('.subtitle-entry'));
|
|
134
|
+
subTitleEntryContainers.push(installCountContainer);
|
|
135
|
+
const installCountWidget = this.instantiationService.createInstance(InstallCountWidget, installCountContainer, false);
|
|
136
|
+
const ratingsContainer = append(subtitle, $('.subtitle-entry'));
|
|
137
|
+
subTitleEntryContainers.push(ratingsContainer);
|
|
138
|
+
const ratingsWidget = this.instantiationService.createInstance(RatingsWidget, ratingsContainer, false);
|
|
139
|
+
const widgets = [
|
|
140
|
+
publisherWidget,
|
|
141
|
+
installCountWidget,
|
|
142
|
+
ratingsWidget,
|
|
143
|
+
];
|
|
144
|
+
const description = append(details, $('.description'));
|
|
145
|
+
const actions = [
|
|
146
|
+
this.instantiationService.createInstance(InstallAction),
|
|
147
|
+
this.instantiationService.createInstance(UninstallAction),
|
|
148
|
+
this.instantiationService.createInstance(ManageMcpServerAction, true),
|
|
149
|
+
];
|
|
150
|
+
const actionsAndStatusContainer = append(details, $('.actions-status-container.mcp-server-actions'));
|
|
151
|
+
const actionBar = this._register(( new ActionBar(actionsAndStatusContainer, {
|
|
152
|
+
actionViewItemProvider: (action, options) => {
|
|
153
|
+
if (action instanceof DropDownAction) {
|
|
154
|
+
return action.createActionViewItem(options);
|
|
155
|
+
}
|
|
156
|
+
return undefined;
|
|
157
|
+
},
|
|
158
|
+
focusOnlyEnabledItems: true
|
|
159
|
+
})));
|
|
160
|
+
actionBar.push(actions, { icon: true, label: true });
|
|
161
|
+
actionBar.setFocusable(true);
|
|
162
|
+
this._register(Event.any(...( actions.map(a => Event.filter(a.onDidChange, e => e.enabled !== undefined))))(() => {
|
|
163
|
+
actionBar.setFocusable(false);
|
|
164
|
+
actionBar.setFocusable(true);
|
|
165
|
+
}));
|
|
166
|
+
const mcpServerContainers = this.instantiationService.createInstance(McpServerContainers, [...actions, ...widgets]);
|
|
167
|
+
for (const disposable of [...actions, ...widgets, mcpServerContainers]) {
|
|
168
|
+
this._register(disposable);
|
|
169
|
+
}
|
|
170
|
+
const onError = Event.chain(actionBar.onDidRun, $ => ( $.map(({ error }) => error))
|
|
171
|
+
.filter(error => !!error));
|
|
172
|
+
this._register(onError(this.onError, this));
|
|
173
|
+
const body = append(root, $('.body'));
|
|
174
|
+
const navbar = ( new NavBar(body));
|
|
175
|
+
const content = append(body, $('.content'));
|
|
176
|
+
content.id = generateUuid();
|
|
177
|
+
this.template = {
|
|
178
|
+
content,
|
|
179
|
+
description,
|
|
180
|
+
header,
|
|
181
|
+
iconContainer,
|
|
182
|
+
name,
|
|
183
|
+
navbar,
|
|
184
|
+
actionsAndStatusContainer,
|
|
185
|
+
actionBar: actionBar,
|
|
186
|
+
set mcpServer(mcpServer) {
|
|
187
|
+
mcpServerContainers.mcpServer = mcpServer;
|
|
188
|
+
let lastNonEmptySubtitleEntryContainer;
|
|
189
|
+
for (const subTitleEntryElement of subTitleEntryContainers) {
|
|
190
|
+
subTitleEntryElement.classList.remove('last-non-empty');
|
|
191
|
+
if (subTitleEntryElement.children.length > 0) {
|
|
192
|
+
lastNonEmptySubtitleEntryContainer = subTitleEntryElement;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (lastNonEmptySubtitleEntryContainer) {
|
|
196
|
+
lastNonEmptySubtitleEntryContainer.classList.add('last-non-empty');
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
async setInput(input, options, context, token) {
|
|
202
|
+
await super.setInput(input, options, context, token);
|
|
203
|
+
if (this.template) {
|
|
204
|
+
await this.render(input.mcpServer, this.template, !!options?.preserveFocus);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
async render(mcpServer, template, preserveFocus) {
|
|
208
|
+
this.activeElement = null;
|
|
209
|
+
this.transientDisposables.clear();
|
|
210
|
+
const token = this.transientDisposables.add(( new CancellationTokenSource())).token;
|
|
211
|
+
this.mcpServerReadme = ( new Cache(() => mcpServer.getReadme(token)));
|
|
212
|
+
template.mcpServer = mcpServer;
|
|
213
|
+
clearNode(template.iconContainer);
|
|
214
|
+
if (mcpServer.iconUrl) {
|
|
215
|
+
const icon = append(template.iconContainer, $('img.icon', { alt: '' }));
|
|
216
|
+
this.transientDisposables.add(addDisposableListener(icon, 'error', () => {
|
|
217
|
+
clearNode(template.iconContainer);
|
|
218
|
+
append(template.iconContainer, $(ThemeIcon.asCSSSelector(mcpServerIcon)));
|
|
219
|
+
}, { once: true }));
|
|
220
|
+
icon.src = mcpServer.iconUrl;
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
append(template.iconContainer, $(ThemeIcon.asCSSSelector(mcpServerIcon)));
|
|
224
|
+
}
|
|
225
|
+
template.name.textContent = mcpServer.label;
|
|
226
|
+
template.name.classList.toggle('clickable', !!mcpServer.url);
|
|
227
|
+
template.description.textContent = mcpServer.description;
|
|
228
|
+
if (mcpServer.url) {
|
|
229
|
+
this.transientDisposables.add(onClick(template.name, () => this.openerService.open(( URI.parse(mcpServer.url)))));
|
|
230
|
+
}
|
|
231
|
+
this.renderNavbar(mcpServer, template, preserveFocus);
|
|
232
|
+
}
|
|
233
|
+
renderNavbar(extension, template, preserveFocus) {
|
|
234
|
+
template.content.innerText = '';
|
|
235
|
+
template.navbar.clear();
|
|
236
|
+
if (this.currentIdentifier !== extension.id) {
|
|
237
|
+
this.initialScrollProgress.clear();
|
|
238
|
+
this.currentIdentifier = extension.id;
|
|
239
|
+
}
|
|
240
|
+
template.navbar.push(McpServerEditorTab.Readme, ( localize(7900, "Details")), ( localize(7901, "Extension details, rendered from the extension's 'README.md' file")));
|
|
241
|
+
if (template.navbar.currentId) {
|
|
242
|
+
this.onNavbarChange(extension, { id: template.navbar.currentId, focus: !preserveFocus }, template);
|
|
243
|
+
}
|
|
244
|
+
template.navbar.onChange(e => this.onNavbarChange(extension, e, template), this, this.transientDisposables);
|
|
245
|
+
}
|
|
246
|
+
clearInput() {
|
|
247
|
+
this.contentDisposables.clear();
|
|
248
|
+
this.transientDisposables.clear();
|
|
249
|
+
super.clearInput();
|
|
250
|
+
}
|
|
251
|
+
focus() {
|
|
252
|
+
super.focus();
|
|
253
|
+
this.activeElement?.focus();
|
|
254
|
+
}
|
|
255
|
+
showFind() {
|
|
256
|
+
this.activeWebview?.showFind();
|
|
257
|
+
}
|
|
258
|
+
runFindAction(previous) {
|
|
259
|
+
this.activeWebview?.runFindAction(previous);
|
|
260
|
+
}
|
|
261
|
+
get activeWebview() {
|
|
262
|
+
if (!this.activeElement || !this.activeElement.runFindAction) {
|
|
263
|
+
return undefined;
|
|
264
|
+
}
|
|
265
|
+
return this.activeElement;
|
|
266
|
+
}
|
|
267
|
+
onNavbarChange(extension, { id, focus }, template) {
|
|
268
|
+
this.contentDisposables.clear();
|
|
269
|
+
template.content.innerText = '';
|
|
270
|
+
this.activeElement = null;
|
|
271
|
+
if (id) {
|
|
272
|
+
const cts = ( new CancellationTokenSource());
|
|
273
|
+
this.contentDisposables.add(toDisposable(() => cts.dispose(true)));
|
|
274
|
+
this.open(id, extension, template, cts.token)
|
|
275
|
+
.then(activeElement => {
|
|
276
|
+
if (cts.token.isCancellationRequested) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
this.activeElement = activeElement;
|
|
280
|
+
if (focus) {
|
|
281
|
+
this.focus();
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
open(id, extension, template, token) {
|
|
287
|
+
switch (id) {
|
|
288
|
+
case McpServerEditorTab.Readme: return this.openDetails(extension, template, token);
|
|
289
|
+
}
|
|
290
|
+
return Promise.resolve(null);
|
|
291
|
+
}
|
|
292
|
+
async openMarkdown(extension, cacheResult, noContentCopy, container, webviewIndex, title, token) {
|
|
293
|
+
try {
|
|
294
|
+
const body = await this.renderMarkdown(extension, cacheResult, container, token);
|
|
295
|
+
if (token.isCancellationRequested) {
|
|
296
|
+
return Promise.resolve(null);
|
|
297
|
+
}
|
|
298
|
+
const webview = this.contentDisposables.add(this.webviewService.createWebviewOverlay({
|
|
299
|
+
title,
|
|
300
|
+
options: {
|
|
301
|
+
enableFindWidget: true,
|
|
302
|
+
tryRestoreScrollPosition: true,
|
|
303
|
+
disableServiceWorker: true,
|
|
304
|
+
},
|
|
305
|
+
contentOptions: {},
|
|
306
|
+
extension: undefined,
|
|
307
|
+
}));
|
|
308
|
+
webview.initialScrollProgress = this.initialScrollProgress.get(webviewIndex) || 0;
|
|
309
|
+
webview.claim(this, this.window, this.scopedContextKeyService);
|
|
310
|
+
setParentFlowTo(webview.container, container);
|
|
311
|
+
webview.layoutWebviewOverElement(container);
|
|
312
|
+
webview.setHtml(body);
|
|
313
|
+
webview.claim(this, this.window, undefined);
|
|
314
|
+
this.contentDisposables.add(webview.onDidFocus(() => this._onDidFocus?.fire()));
|
|
315
|
+
this.contentDisposables.add(webview.onDidScroll(() => this.initialScrollProgress.set(webviewIndex, webview.initialScrollProgress)));
|
|
316
|
+
const removeLayoutParticipant = insert(this.layoutParticipants, {
|
|
317
|
+
layout: () => {
|
|
318
|
+
webview.layoutWebviewOverElement(container);
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
this.contentDisposables.add(toDisposable(removeLayoutParticipant));
|
|
322
|
+
let isDisposed = false;
|
|
323
|
+
this.contentDisposables.add(toDisposable(() => { isDisposed = true; }));
|
|
324
|
+
this.contentDisposables.add(this.themeService.onDidColorThemeChange(async () => {
|
|
325
|
+
const body = await this.renderMarkdown(extension, cacheResult, container);
|
|
326
|
+
if (!isDisposed) {
|
|
327
|
+
webview.setHtml(body);
|
|
328
|
+
}
|
|
329
|
+
}));
|
|
330
|
+
this.contentDisposables.add(webview.onDidClickLink(link => {
|
|
331
|
+
if (!link) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
if (matchesScheme(link, Schemas.http) || matchesScheme(link, Schemas.https) || matchesScheme(link, Schemas.mailto)) {
|
|
335
|
+
this.openerService.open(link);
|
|
336
|
+
}
|
|
337
|
+
}));
|
|
338
|
+
return webview;
|
|
339
|
+
}
|
|
340
|
+
catch (e) {
|
|
341
|
+
const p = append(container, $('p.nocontent'));
|
|
342
|
+
p.textContent = noContentCopy;
|
|
343
|
+
return p;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
async renderMarkdown(extension, cacheResult, container, token) {
|
|
347
|
+
const contents = await this.loadContents(() => cacheResult, container);
|
|
348
|
+
if (token?.isCancellationRequested) {
|
|
349
|
+
return '';
|
|
350
|
+
}
|
|
351
|
+
const content = await renderMarkdownDocument(contents, this.extensionService, this.languageService, { shouldSanitize: true, token });
|
|
352
|
+
if (token?.isCancellationRequested) {
|
|
353
|
+
return '';
|
|
354
|
+
}
|
|
355
|
+
return this.renderBody(content);
|
|
356
|
+
}
|
|
357
|
+
renderBody(body) {
|
|
358
|
+
const nonce = generateUuid();
|
|
359
|
+
const colorMap = TokenizationRegistry.getColorMap();
|
|
360
|
+
const css = colorMap ? generateTokensCSSForColorMap(colorMap) : '';
|
|
361
|
+
return `<!DOCTYPE html>
|
|
362
|
+
<html>
|
|
363
|
+
<head>
|
|
364
|
+
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
|
365
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; script-src 'none'; style-src 'nonce-${nonce}';">
|
|
366
|
+
<style nonce="${nonce}">
|
|
367
|
+
${DEFAULT_MARKDOWN_STYLES}
|
|
368
|
+
|
|
369
|
+
/* prevent scroll-to-top button from blocking the body text */
|
|
370
|
+
body {
|
|
371
|
+
padding-bottom: 75px;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
#scroll-to-top {
|
|
375
|
+
position: fixed;
|
|
376
|
+
width: 32px;
|
|
377
|
+
height: 32px;
|
|
378
|
+
right: 25px;
|
|
379
|
+
bottom: 25px;
|
|
380
|
+
background-color: var(--vscode-button-secondaryBackground);
|
|
381
|
+
border-color: var(--vscode-button-border);
|
|
382
|
+
border-radius: 50%;
|
|
383
|
+
cursor: pointer;
|
|
384
|
+
box-shadow: 1px 1px 1px rgba(0,0,0,.25);
|
|
385
|
+
outline: none;
|
|
386
|
+
display: flex;
|
|
387
|
+
justify-content: center;
|
|
388
|
+
align-items: center;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
#scroll-to-top:hover {
|
|
392
|
+
background-color: var(--vscode-button-secondaryHoverBackground);
|
|
393
|
+
box-shadow: 2px 2px 2px rgba(0,0,0,.25);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
body.vscode-high-contrast #scroll-to-top {
|
|
397
|
+
border-width: 2px;
|
|
398
|
+
border-style: solid;
|
|
399
|
+
box-shadow: none;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
#scroll-to-top span.icon::before {
|
|
403
|
+
content: "";
|
|
404
|
+
display: block;
|
|
405
|
+
background: var(--vscode-button-secondaryForeground);
|
|
406
|
+
/* Chevron up icon */
|
|
407
|
+
webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
|
|
408
|
+
-webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
|
|
409
|
+
width: 16px;
|
|
410
|
+
height: 16px;
|
|
411
|
+
}
|
|
412
|
+
${css}
|
|
413
|
+
</style>
|
|
414
|
+
</head>
|
|
415
|
+
<body>
|
|
416
|
+
<a id="scroll-to-top" role="button" aria-label="scroll to top" href="#"><span class="icon"></span></a>
|
|
417
|
+
${body}
|
|
418
|
+
</body>
|
|
419
|
+
</html>`;
|
|
420
|
+
}
|
|
421
|
+
async openDetails(extension, template, token) {
|
|
422
|
+
const details = append(template.content, $('.details'));
|
|
423
|
+
const readmeContainer = append(details, $('.readme-container'));
|
|
424
|
+
const additionalDetailsContainer = append(details, $('.additional-details-container'));
|
|
425
|
+
const layout = () => details.classList.toggle('narrow', this.dimension && this.dimension.width < 500);
|
|
426
|
+
layout();
|
|
427
|
+
this.contentDisposables.add(toDisposable(insert(this.layoutParticipants, { layout })));
|
|
428
|
+
const activeElement = await this.openMarkdown(extension, this.mcpServerReadme.get(), ( localize(7902, "No README available.")), readmeContainer, WebviewIndex.Readme, ( localize(7903, "Readme")), token);
|
|
429
|
+
this.renderAdditionalDetails(additionalDetailsContainer, extension);
|
|
430
|
+
return activeElement;
|
|
431
|
+
}
|
|
432
|
+
renderAdditionalDetails(container, extension) {
|
|
433
|
+
const content = $('div', { class: 'additional-details-content', tabindex: '0' });
|
|
434
|
+
const scrollableContent = ( new DomScrollableElement(content, {}));
|
|
435
|
+
const layout = () => scrollableContent.scanDomNode();
|
|
436
|
+
const removeLayoutParticipant = insert(this.layoutParticipants, { layout });
|
|
437
|
+
this.contentDisposables.add(toDisposable(removeLayoutParticipant));
|
|
438
|
+
this.contentDisposables.add(scrollableContent);
|
|
439
|
+
this.contentDisposables.add(this.instantiationService.createInstance(AdditionalDetailsWidget, content, extension));
|
|
440
|
+
append(container, scrollableContent.getDomNode());
|
|
441
|
+
scrollableContent.scanDomNode();
|
|
442
|
+
}
|
|
443
|
+
loadContents(loadingTask, container) {
|
|
444
|
+
container.classList.add('loading');
|
|
445
|
+
const result = this.contentDisposables.add(loadingTask());
|
|
446
|
+
const onDone = () => container.classList.remove('loading');
|
|
447
|
+
result.promise.then(onDone, onDone);
|
|
448
|
+
return result.promise;
|
|
449
|
+
}
|
|
450
|
+
layout(dimension) {
|
|
451
|
+
this.dimension = dimension;
|
|
452
|
+
this.layoutParticipants.forEach(p => p.layout());
|
|
453
|
+
}
|
|
454
|
+
onError(err) {
|
|
455
|
+
if (isCancellationError(err)) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
this.notificationService.error(err);
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
McpServerEditor = McpServerEditor_1 = ( __decorate([
|
|
462
|
+
( __param(1, ITelemetryService)),
|
|
463
|
+
( __param(2, IInstantiationService)),
|
|
464
|
+
( __param(3, IThemeService)),
|
|
465
|
+
( __param(4, INotificationService)),
|
|
466
|
+
( __param(5, IOpenerService)),
|
|
467
|
+
( __param(6, IStorageService)),
|
|
468
|
+
( __param(7, IExtensionService)),
|
|
469
|
+
( __param(8, IWebviewService)),
|
|
470
|
+
( __param(9, ILanguageService)),
|
|
471
|
+
( __param(10, IContextKeyService)),
|
|
472
|
+
( __param(11, IHoverService))
|
|
473
|
+
], McpServerEditor));
|
|
474
|
+
let AdditionalDetailsWidget = class AdditionalDetailsWidget extends Disposable {
|
|
475
|
+
constructor(container, extension, hoverService, openerService) {
|
|
476
|
+
super();
|
|
477
|
+
this.container = container;
|
|
478
|
+
this.hoverService = hoverService;
|
|
479
|
+
this.openerService = openerService;
|
|
480
|
+
this.disposables = this._register(( new DisposableStore()));
|
|
481
|
+
this.render(extension);
|
|
482
|
+
}
|
|
483
|
+
render(extension) {
|
|
484
|
+
this.container.innerText = '';
|
|
485
|
+
this.disposables.clear();
|
|
486
|
+
if (extension.local) {
|
|
487
|
+
this.renderInstallInfo(this.container, extension.local);
|
|
488
|
+
}
|
|
489
|
+
if (extension.gallery) {
|
|
490
|
+
this.renderMarketplaceInfo(this.container, extension);
|
|
491
|
+
}
|
|
492
|
+
this.renderExtensionResources(this.container, extension);
|
|
493
|
+
}
|
|
494
|
+
renderExtensionResources(container, extension) {
|
|
495
|
+
const resources = [];
|
|
496
|
+
if (extension.repository) {
|
|
497
|
+
try {
|
|
498
|
+
resources.push([( localize(7904, "Repository")), ( URI.parse(extension.repository))]);
|
|
499
|
+
}
|
|
500
|
+
catch (error) { }
|
|
501
|
+
}
|
|
502
|
+
if (extension.publisherUrl && extension.publisherDisplayName) {
|
|
503
|
+
resources.push([extension.publisherDisplayName, ( URI.parse(extension.publisherUrl))]);
|
|
504
|
+
}
|
|
505
|
+
if (resources.length) {
|
|
506
|
+
const extensionResourcesContainer = append(container, $('.resources-container.additional-details-element'));
|
|
507
|
+
append(extensionResourcesContainer, $('.additional-details-title', undefined, ( localize(7905, "Resources"))));
|
|
508
|
+
const resourcesElement = append(extensionResourcesContainer, $('.resources'));
|
|
509
|
+
for (const [label, uri] of resources) {
|
|
510
|
+
const resource = append(resourcesElement, $('a.resource', { tabindex: '0' }, label));
|
|
511
|
+
this.disposables.add(onClick(resource, () => this.openerService.open(uri)));
|
|
512
|
+
this.disposables.add(this.hoverService.setupManagedHover(getDefaultHoverDelegate('mouse'), resource, ( uri.toString())));
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
renderInstallInfo(container, extension) {
|
|
517
|
+
const installInfoContainer = append(container, $('.more-info-container.additional-details-element'));
|
|
518
|
+
append(installInfoContainer, $('.additional-details-title', undefined, ( localize(7906, "Installation"))));
|
|
519
|
+
const installInfo = append(installInfoContainer, $('.more-info'));
|
|
520
|
+
append(installInfo, $('.more-info-entry', undefined, $('div.more-info-entry-name', undefined, ( localize(7907, "Identifier"))), $('code', undefined, extension.name)));
|
|
521
|
+
append(installInfo, $('.more-info-entry', undefined, $('div.more-info-entry-name', undefined, ( localize(7908, "Version"))), $('code', undefined, extension.version)));
|
|
522
|
+
}
|
|
523
|
+
renderMarketplaceInfo(container, extension) {
|
|
524
|
+
const gallery = extension.gallery;
|
|
525
|
+
const moreInfoContainer = append(container, $('.more-info-container.additional-details-element'));
|
|
526
|
+
append(moreInfoContainer, $('.additional-details-title', undefined, ( localize(7909, "Marketplace"))));
|
|
527
|
+
const moreInfo = append(moreInfoContainer, $('.more-info'));
|
|
528
|
+
if (gallery) {
|
|
529
|
+
if (!extension.local) {
|
|
530
|
+
append(moreInfo, $('.more-info-entry', undefined, $('div.more-info-entry-name', undefined, ( localize(7907, "Identifier"))), $('code', undefined, extension.name)));
|
|
531
|
+
append(moreInfo, $('.more-info-entry', undefined, $('div.more-info-entry-name', undefined, ( localize(7908, "Version"))), $('code', undefined, gallery.version)));
|
|
532
|
+
}
|
|
533
|
+
append(moreInfo, $('.more-info-entry', undefined, $('div.more-info-entry-name', undefined, ( localize(7910, "Last Released"))), $('div', undefined, toDateString(( new Date(gallery.lastUpdated))))));
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
AdditionalDetailsWidget = ( __decorate([
|
|
538
|
+
( __param(2, IHoverService)),
|
|
539
|
+
( __param(3, IOpenerService))
|
|
540
|
+
], AdditionalDetailsWidget));
|
|
541
|
+
|
|
542
|
+
export { McpServerEditor };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
2
|
+
import { EditorInputCapabilities, IUntypedEditorInput } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor";
|
|
3
|
+
import { EditorInput } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/editorInput";
|
|
4
|
+
import { ThemeIcon } from "@codingame/monaco-vscode-api/vscode/vs/base/common/themables";
|
|
5
|
+
import { IWorkbenchMcpServer } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
|
|
6
|
+
export declare class McpServerEditorInput extends EditorInput {
|
|
7
|
+
private _mcpServer;
|
|
8
|
+
static readonly ID = "workbench.mcpServer.input2";
|
|
9
|
+
get typeId(): string;
|
|
10
|
+
get capabilities(): EditorInputCapabilities;
|
|
11
|
+
get resource(): URI;
|
|
12
|
+
constructor(_mcpServer: IWorkbenchMcpServer);
|
|
13
|
+
get mcpServer(): IWorkbenchMcpServer;
|
|
14
|
+
getName(): string;
|
|
15
|
+
getIcon(): ThemeIcon | undefined;
|
|
16
|
+
matches(other: EditorInput | IUntypedEditorInput): boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
3
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
4
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
5
|
+
import { EditorInputCapabilities } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
6
|
+
import { EditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/editorInput';
|
|
7
|
+
import { join } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
8
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
9
|
+
import { registerIcon } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/iconRegistry';
|
|
10
|
+
|
|
11
|
+
const ExtensionEditorIcon = registerIcon('extensions-editor-label-icon', Codicon.extensions, ( localize(7911, 'Icon of the extensions editor label.')));
|
|
12
|
+
class McpServerEditorInput extends EditorInput {
|
|
13
|
+
static { this.ID = 'workbench.mcpServer.input2'; }
|
|
14
|
+
get typeId() {
|
|
15
|
+
return McpServerEditorInput.ID;
|
|
16
|
+
}
|
|
17
|
+
get capabilities() {
|
|
18
|
+
return EditorInputCapabilities.Readonly | EditorInputCapabilities.Singleton;
|
|
19
|
+
}
|
|
20
|
+
get resource() {
|
|
21
|
+
return ( URI.from({
|
|
22
|
+
scheme: Schemas.extension,
|
|
23
|
+
path: join(this.mcpServer.id, 'mcpServer')
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
constructor(_mcpServer) {
|
|
27
|
+
super();
|
|
28
|
+
this._mcpServer = _mcpServer;
|
|
29
|
+
}
|
|
30
|
+
get mcpServer() { return this._mcpServer; }
|
|
31
|
+
getName() {
|
|
32
|
+
return localize(7912, "Extension: {0}", this._mcpServer.label);
|
|
33
|
+
}
|
|
34
|
+
getIcon() {
|
|
35
|
+
return ExtensionEditorIcon;
|
|
36
|
+
}
|
|
37
|
+
matches(other) {
|
|
38
|
+
if (super.matches(other)) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return other instanceof McpServerEditorInput && this._mcpServer.name === other._mcpServer.name;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { McpServerEditorInput };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
|
|
3
|
+
import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
|
|
4
|
+
import { IMcpServerContainer, IWorkbenchMcpServer } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
|
|
5
|
+
export declare abstract class McpServerWidget extends Disposable implements IMcpServerContainer {
|
|
6
|
+
private _mcpServer;
|
|
7
|
+
get mcpServer(): IWorkbenchMcpServer | null;
|
|
8
|
+
set mcpServer(mcpServer: IWorkbenchMcpServer | null);
|
|
9
|
+
update(): void;
|
|
10
|
+
abstract render(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare function onClick(element: HTMLElement, callback: () => void): IDisposable;
|
|
13
|
+
export declare class McpServerIconWidget extends McpServerWidget {
|
|
14
|
+
private readonly disposables;
|
|
15
|
+
private readonly element;
|
|
16
|
+
private readonly iconElement;
|
|
17
|
+
private readonly defaultIconElement;
|
|
18
|
+
private iconUrl;
|
|
19
|
+
constructor(container: HTMLElement);
|
|
20
|
+
private clear;
|
|
21
|
+
render(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare class PublisherWidget extends McpServerWidget {
|
|
24
|
+
readonly container: HTMLElement;
|
|
25
|
+
private small;
|
|
26
|
+
private readonly hoverService;
|
|
27
|
+
private readonly openerService;
|
|
28
|
+
private element;
|
|
29
|
+
private containerHover;
|
|
30
|
+
private readonly disposables;
|
|
31
|
+
constructor(container: HTMLElement, small: boolean, hoverService: IHoverService, openerService: IOpenerService);
|
|
32
|
+
private clear;
|
|
33
|
+
render(): void;
|
|
34
|
+
}
|
|
35
|
+
export declare class InstallCountWidget extends McpServerWidget {
|
|
36
|
+
readonly container: HTMLElement;
|
|
37
|
+
private small;
|
|
38
|
+
private readonly hoverService;
|
|
39
|
+
private readonly disposables;
|
|
40
|
+
constructor(container: HTMLElement, small: boolean, hoverService: IHoverService);
|
|
41
|
+
private clear;
|
|
42
|
+
render(): void;
|
|
43
|
+
static getInstallLabel(extension: IWorkbenchMcpServer, small: boolean): string | undefined;
|
|
44
|
+
}
|
|
45
|
+
export declare class RatingsWidget extends McpServerWidget {
|
|
46
|
+
readonly container: HTMLElement;
|
|
47
|
+
private small;
|
|
48
|
+
private readonly hoverService;
|
|
49
|
+
private containerHover;
|
|
50
|
+
private readonly disposables;
|
|
51
|
+
constructor(container: HTMLElement, small: boolean, hoverService: IHoverService);
|
|
52
|
+
private clear;
|
|
53
|
+
render(): void;
|
|
54
|
+
}
|