@codingame/monaco-vscode-extensions-service-override
Advanced tools
Comparing version 6.0.3 to 7.0.0
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service'; | ||
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service'; | ||
import { toExtensionDescription } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions'; | ||
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service'; | ||
@@ -48,2 +47,3 @@ import { ILogService, ILoggerService } from 'vscode/vscode/vs/platform/log/common/log.service'; | ||
import './vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js'; | ||
import './vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.js'; | ||
import './vscode/src/vs/workbench/api/browser/mainThreadEmbeddings.js'; | ||
@@ -219,8 +219,2 @@ import './vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js'; | ||
} | ||
async _scanSingleExtension(extension) { | ||
if (extension.location.scheme === CustomSchemas.extensionFile) { | ||
return toExtensionDescription(extension); | ||
} | ||
return super._scanSingleExtension(extension); | ||
} | ||
}; | ||
@@ -227,0 +221,0 @@ ExtensionServiceOverride = __decorate([ |
{ | ||
"name": "@codingame/monaco-vscode-extensions-service-override", | ||
"version": "6.0.3", | ||
"version": "7.0.0", | ||
"keywords": [], | ||
@@ -29,5 +29,5 @@ "author": { | ||
"dependencies": { | ||
"vscode": "npm:@codingame/monaco-vscode-api@6.0.3", | ||
"@codingame/monaco-vscode-files-service-override": "6.0.3" | ||
"vscode": "npm:@codingame/monaco-vscode-api@7.0.0", | ||
"@codingame/monaco-vscode-files-service-override": "7.0.0" | ||
} | ||
} |
@@ -148,3 +148,3 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
extension: newVersion, | ||
options: { operation: InstallOperation.Update, installPreReleaseVersion: oldVersion.preRelease, profileLocation } | ||
options: { operation: InstallOperation.Update, installPreReleaseVersion: oldVersion.preRelease, profileLocation, isApplicationScoped: oldVersion.isApplicationScoped } | ||
}); | ||
@@ -259,3 +259,3 @@ } | ||
extension: gallery, | ||
options: { ...installOptions, installGivenVersion: !!version }, | ||
options: { ...installOptions, installGivenVersion: !!version, isApplicationScoped: installedExtension?.isApplicationScoped }, | ||
}); | ||
@@ -262,0 +262,0 @@ })))); |
@@ -32,4 +32,4 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
} | ||
async getSessions(scopes) { | ||
return this._proxy.$getSessions(this.id, scopes); | ||
async getSessions(scopes, options) { | ||
return this._proxy.$getSessions(this.id, scopes, options); | ||
} | ||
@@ -149,3 +149,3 @@ createSession(scopes, options) { | ||
async doGetSession(providerId, scopes, extensionId, extensionName, options) { | ||
const sessions = await this.authenticationService.getSessions(providerId, scopes, true); | ||
const sessions = await this.authenticationService.getSessions(providerId, scopes, options.account, true); | ||
const provider = this.authenticationService.getProvider(providerId); | ||
@@ -198,3 +198,3 @@ if (options.forceNewSession && options.createIfNone) { | ||
if (sessions?.length && !options.forceNewSession) { | ||
session = provider.supportsMultipleAccounts | ||
session = provider.supportsMultipleAccounts && !options.account | ||
? await this.authenticationExtensionsService.selectSession(providerId, extensionId, extensionName, scopes, sessions) | ||
@@ -204,11 +204,8 @@ : sessions[0]; | ||
else { | ||
let sessionToRecreate; | ||
if (typeof options.forceNewSession === 'object' && options.forceNewSession.sessionToRecreate) { | ||
sessionToRecreate = options.forceNewSession.sessionToRecreate; | ||
} | ||
else { | ||
let account = options.account; | ||
if (!account) { | ||
const sessionIdToRecreate = this.authenticationExtensionsService.getSessionPreference(providerId, extensionId, scopes); | ||
sessionToRecreate = sessionIdToRecreate ? sessions.find(session => session.id === sessionIdToRecreate) : undefined; | ||
account = sessionIdToRecreate ? sessions.find(session => session.id === sessionIdToRecreate)?.account : undefined; | ||
} | ||
session = await this.authenticationService.createSession(providerId, scopes, { activateImmediate: true, sessionToRecreate }); | ||
session = await this.authenticationService.createSession(providerId, scopes, { activateImmediate: true, account }); | ||
} | ||
@@ -238,12 +235,13 @@ this.authenticationAccessService.updateAllowedExtensions(providerId, session.account.label, [{ id: extensionId, name: extensionName, allowed: true }]); | ||
} | ||
async $getSessions(providerId, scopes, extensionId, extensionName) { | ||
const sessions = await this.authenticationService.getSessions(providerId, [...scopes], true); | ||
const accessibleSessions = sessions.filter(s => this.authenticationAccessService.isAccessAllowed(providerId, s.account.label, extensionId)); | ||
if (accessibleSessions.length) { | ||
this.sendProviderUsageTelemetry(extensionId, providerId); | ||
for (const session of accessibleSessions) { | ||
this.authenticationUsageService.addAccountUsage(providerId, session.account.label, extensionId, extensionName); | ||
async $getAccounts(providerId) { | ||
const sessions = await this.authenticationService.getSessions(providerId); | ||
const accounts = ( (new Array())); | ||
const seenAccounts = ( (new Set())); | ||
for (const session of sessions) { | ||
if (!( (seenAccounts.has(session.account.label)))) { | ||
seenAccounts.add(session.account.label); | ||
accounts.push(session.account); | ||
} | ||
} | ||
return accessibleSessions; | ||
return accounts; | ||
} | ||
@@ -250,0 +248,0 @@ sendProviderUsageTelemetry(extensionId, providerId) { |
@@ -163,3 +163,4 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
if (!data) { | ||
throw ( new Error(`No agent with handle ${handle} registered`)); | ||
this._logService.error(`MainThreadChatAgents2#$updateAgent: No agent with handle ${handle} registered`); | ||
return; | ||
} | ||
@@ -166,0 +167,0 @@ data.hasFollowups = metadataUpdate.hasFollowups; |
@@ -35,5 +35,2 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
} | ||
$attachContext(name, value, location) { | ||
this._chatVariablesService.attachContext(name, revive(value), location); | ||
} | ||
}; | ||
@@ -40,0 +37,0 @@ MainThreadChatVariables = __decorate([ |
@@ -22,2 +22,5 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service'; | ||
import { revealCommentThread } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsController'; | ||
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service'; | ||
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service'; | ||
@@ -112,3 +115,3 @@ const _moduleId = "vs/workbench/api/browser/mainThreadComments"; | ||
} | ||
constructor(commentThreadHandle, controllerHandle, extensionId, threadId, resource, _range, _canReply, _isTemplate, editorId) { | ||
constructor(commentThreadHandle, controllerHandle, extensionId, threadId, resource, _range, comments, _canReply, _isTemplate, editorId) { | ||
this.commentThreadHandle = commentThreadHandle; | ||
@@ -142,2 +145,5 @@ this.controllerHandle = controllerHandle; | ||
} | ||
else if (comments) { | ||
this._comments = comments; | ||
} | ||
} | ||
@@ -238,3 +244,3 @@ batchUpdate(changes) { | ||
} | ||
createCommentThread(extensionId, commentThreadHandle, threadId, resource, range, isTemplate, editorId) { | ||
createCommentThread(extensionId, commentThreadHandle, threadId, resource, range, comments, isTemplate, editorId) { | ||
const thread = ( (new MainThreadCommentThread( | ||
@@ -247,2 +253,3 @@ commentThreadHandle, | ||
range, | ||
comments, | ||
true, | ||
@@ -419,3 +426,3 @@ isTemplate, | ||
let MainThreadComments = class MainThreadComments extends Disposable { | ||
constructor(extHostContext, _commentService, _viewsService, _viewDescriptorService) { | ||
constructor(extHostContext, _commentService, _viewsService, _viewDescriptorService, _uriIdentityService, _editorService) { | ||
super(); | ||
@@ -425,2 +432,4 @@ this._commentService = _commentService; | ||
this._viewDescriptorService = _viewDescriptorService; | ||
this._uriIdentityService = _uriIdentityService; | ||
this._editorService = _editorService; | ||
this._handlers = ( (new Map())); | ||
@@ -474,3 +483,3 @@ this._commentControllers = ( (new Map())); | ||
} | ||
$createCommentThread(handle, commentThreadHandle, threadId, resource, range, extensionId, isTemplate, editorId) { | ||
$createCommentThread(handle, commentThreadHandle, threadId, resource, range, comments, extensionId, isTemplate, editorId) { | ||
const provider = this._commentControllers.get(handle); | ||
@@ -480,3 +489,3 @@ if (!provider) { | ||
} | ||
return provider.createCommentThread(extensionId.value, commentThreadHandle, threadId, resource, range, isTemplate, editorId); | ||
return provider.createCommentThread(extensionId.value, commentThreadHandle, threadId, resource, range, comments, isTemplate, editorId); | ||
} | ||
@@ -504,2 +513,13 @@ $updateCommentThread(handle, commentThreadHandle, threadId, resource, changes) { | ||
} | ||
async $revealCommentThread(handle, commentThreadHandle, options) { | ||
const provider = this._commentControllers.get(handle); | ||
if (!provider) { | ||
return Promise.resolve(); | ||
} | ||
const thread = provider.getAllComments().find(thread => thread.commentThreadHandle === commentThreadHandle); | ||
if (!thread || !thread.isDocumentCommentThread()) { | ||
return Promise.resolve(); | ||
} | ||
revealCommentThread(this._commentService, this._editorService, this._uriIdentityService, thread, undefined, options.focusReply, undefined, options.preserveFocus); | ||
} | ||
registerView(commentsViewAlreadyRegistered) { | ||
@@ -583,5 +603,7 @@ if (!commentsViewAlreadyRegistered) { | ||
( (__param(2, IViewsService))), | ||
( (__param(3, IViewDescriptorService))) | ||
( (__param(3, IViewDescriptorService))), | ||
( (__param(4, IUriIdentityService))), | ||
( (__param(5, IEditorService))) | ||
], MainThreadComments); | ||
export { MainThreadCommentController, MainThreadCommentThread, MainThreadComments }; |
@@ -277,2 +277,3 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
saveBeforeRestart: saveBeforeStart, | ||
testRun: options.testRun, | ||
suppressDebugStatusbar: options.suppressDebugStatusbar, | ||
@@ -279,0 +280,0 @@ suppressDebugToolbar: options.suppressDebugToolbar, |
import { __decorate } from 'vscode/external/tslib/tslib.es6.js'; | ||
import { ErrorNoTelemetry, onUnexpectedError } from 'vscode/vscode/vs/base/common/errors'; | ||
import { transformErrorFromSerialization, onUnexpectedError } from 'vscode/vscode/vs/base/common/errors'; | ||
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js'; | ||
@@ -11,7 +11,3 @@ import { MainContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol'; | ||
if (err && err.$isError) { | ||
const { name, message, stack } = err; | ||
err = err.noTelemetry ? ( new ErrorNoTelemetry()) : ( new Error()); | ||
err.message = message; | ||
err.name = name; | ||
err.stack = stack; | ||
err = transformErrorFromSerialization(err); | ||
} | ||
@@ -18,0 +14,0 @@ onUnexpectedError(err); |
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
import { Action } from 'vscode/vscode/vs/base/common/actions'; | ||
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation'; | ||
import { transformErrorFromSerialization } from 'vscode/vscode/vs/base/common/errors'; | ||
import { FileAccess } from 'vscode/vscode/vs/base/common/network'; | ||
@@ -57,6 +58,3 @@ import Severity$1 from 'vscode/vscode/vs/base/common/severity'; | ||
$onExtensionRuntimeError(extensionId, data) { | ||
const error = ( (new Error())); | ||
error.name = data.name; | ||
error.message = data.message; | ||
error.stack = data.stack; | ||
const error = transformErrorFromSerialization(data); | ||
this._internalExtensionService._onExtensionRuntimeError(extensionId, error); | ||
@@ -67,6 +65,3 @@ console.error(`[${extensionId.value}]${error.message}`); | ||
async $onExtensionActivationError(extensionId, data, missingExtensionDependency) { | ||
const error = ( (new Error())); | ||
error.name = data.name; | ||
error.message = data.message; | ||
error.stack = data.stack; | ||
const error = transformErrorFromSerialization(data); | ||
this._internalExtensionService._onDidActivateExtensionError(extensionId, error); | ||
@@ -73,0 +68,0 @@ if (missingExtensionDependency) { |
@@ -500,2 +500,5 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
}, | ||
provideInlineEdits: async (model, range, context, token) => { | ||
return this._proxy.$provideInlineEdits(handle, model.uri, range, context, token); | ||
}, | ||
handleItemDidShow: async (completions, item, updatedInsertText) => { | ||
@@ -940,10 +943,15 @@ if (supportsHandleEvents) { | ||
} | ||
return ( edits.map(edit => { | ||
return { | ||
...edit, | ||
yieldTo: edit.yieldTo?.map(x => ({ kind: ( new HierarchicalKind(x)) })), | ||
kind: edit.kind ? ( new HierarchicalKind(edit.kind)) : undefined, | ||
additionalEdit: reviveWorkspaceEditDto(edit.additionalEdit, this._uriIdentService, dataId => this.resolveDocumentOnDropFileData(request.id, dataId)), | ||
}; | ||
})); | ||
return { | ||
edits: ( edits.map(edit => { | ||
return { | ||
...edit, | ||
yieldTo: edit.yieldTo?.map(x => ({ kind: ( new HierarchicalKind(x)) })), | ||
kind: edit.kind ? ( new HierarchicalKind(edit.kind)) : undefined, | ||
additionalEdit: reviveWorkspaceEditDto(edit.additionalEdit, this._uriIdentService, dataId => this.resolveDocumentOnDropFileData(request.id, dataId)), | ||
}; | ||
})), | ||
dispose: () => { | ||
this._proxy.$releaseDocumentOnDropEdits(this._handle, request.id); | ||
}, | ||
}; | ||
} | ||
@@ -950,0 +958,0 @@ finally { |
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
import { DeferredPromise, AsyncIterableSource } from 'vscode/vscode/vs/base/common/async'; | ||
import { transformErrorFromSerialization, transformErrorForSerialization } from 'vscode/vscode/vs/base/common/errors'; | ||
import { Emitter } from 'vscode/vscode/vs/base/common/event'; | ||
@@ -6,3 +8,2 @@ import { DisposableStore, DisposableMap, Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle'; | ||
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service'; | ||
import { Progress } from 'vscode/vscode/vs/platform/progress/common/progress'; | ||
import { ExtHostContext, MainContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol'; | ||
@@ -43,11 +44,18 @@ import { ILanguageModelStatsService } from 'vscode/vscode/vs/workbench/contrib/chat/common/languageModelStats.service'; | ||
metadata, | ||
provideChatResponse: async (messages, from, options, progress, token) => { | ||
sendChatRequest: async (messages, from, options, token) => { | ||
const requestId = (Math.random() * 1e6) | 0; | ||
this._pendingProgress.set(requestId, progress); | ||
const defer = ( (new DeferredPromise())); | ||
const stream = ( (new AsyncIterableSource())); | ||
try { | ||
await this._proxy.$provideLanguageModelResponse(handle, requestId, from, messages, options, token); | ||
this._pendingProgress.set(requestId, { defer, stream }); | ||
await this._proxy.$startChatRequest(handle, requestId, from, messages, options, token); | ||
} | ||
finally { | ||
catch (err) { | ||
this._pendingProgress.delete(requestId); | ||
throw err; | ||
} | ||
return { | ||
result: defer.p, | ||
stream: stream.asyncIterable | ||
}; | ||
}, | ||
@@ -63,5 +71,25 @@ provideTokenCount: (str, token) => { | ||
} | ||
async $handleProgressChunk(requestId, chunk) { | ||
this._pendingProgress.get(requestId)?.report(chunk); | ||
async $reportResponsePart(requestId, chunk) { | ||
const data = this._pendingProgress.get(requestId); | ||
this._logService.trace('[LM] report response PART', Boolean(data), requestId, chunk); | ||
if (data) { | ||
data.stream.emitOne(chunk); | ||
} | ||
} | ||
async $reportResponseDone(requestId, err) { | ||
const data = this._pendingProgress.get(requestId); | ||
this._logService.trace('[LM] report response DONE', Boolean(data), requestId, err); | ||
if (data) { | ||
this._pendingProgress.delete(requestId); | ||
if (err) { | ||
const error = transformErrorFromSerialization(err); | ||
data.stream.reject(error); | ||
data.defer.error(error); | ||
} | ||
else { | ||
data.stream.resolve(); | ||
data.defer.complete(undefined); | ||
} | ||
} | ||
} | ||
$unregisterProvider(handle) { | ||
@@ -76,14 +104,25 @@ this._providerRegistrations.deleteAndDispose(handle); | ||
} | ||
async $fetchResponse(extension, providerId, requestId, messages, options, token) { | ||
this._logService.debug('[CHAT] extension request STARTED', extension.value, requestId); | ||
const task = this._chatProviderService.makeLanguageModelChatRequest(providerId, extension, messages, options, ( (new Progress(value => { | ||
this._proxy.$handleResponseFragment(requestId, value); | ||
}))), token); | ||
task.catch(err => { | ||
async $tryStartChatRequest(extension, providerId, requestId, messages, options, token) { | ||
this._logService.trace('[CHAT] request STARTED', extension.value, requestId); | ||
const response = await this._chatProviderService.sendChatRequest(providerId, extension, messages, options, token); | ||
const streaming = (async () => { | ||
try { | ||
for await (const part of response.stream) { | ||
this._logService.trace('[CHAT] request PART', extension.value, requestId, part); | ||
await this._proxy.$acceptResponsePart(requestId, part); | ||
} | ||
this._logService.trace('[CHAT] request DONE', extension.value, requestId); | ||
} | ||
catch (err) { | ||
this._logService.error('[CHAT] extension request ERRORED in STREAM', err, extension.value, requestId); | ||
this._proxy.$acceptResponseDone(requestId, transformErrorForSerialization(err)); | ||
} | ||
})(); | ||
Promise.allSettled([response.result, streaming]).then(() => { | ||
this._logService.debug('[CHAT] extension request DONE', extension.value, requestId); | ||
this._proxy.$acceptResponseDone(requestId, undefined); | ||
}, err => { | ||
this._logService.error('[CHAT] extension request ERRORED', err, extension.value, requestId); | ||
throw err; | ||
}).finally(() => { | ||
this._logService.debug('[CHAT] extension request DONE', extension.value, requestId); | ||
this._proxy.$acceptResponseDone(requestId, transformErrorForSerialization(err)); | ||
}); | ||
return task; | ||
} | ||
@@ -147,5 +186,5 @@ $countTokens(provider, value, token) { | ||
} | ||
return [await this.createSession(scopes || [], {})]; | ||
return [await this.createSession(scopes || [])]; | ||
} | ||
async createSession(scopes, options) { | ||
async createSession(scopes) { | ||
this._session = this._createFakeSession(scopes); | ||
@@ -152,0 +191,0 @@ this._onDidChangeSessions.fire({ added: [this._session], changed: [], removed: [] }); |
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
import { Barrier } from 'vscode/vscode/vs/base/common/async'; | ||
import { URI } from 'vscode/vscode/vs/base/common/uri'; | ||
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event'; | ||
import { observableValue } from 'vscode/vscode/vs/base/common/observableInternal/base'; | ||
import 'vscode/vscode/vs/base/common/observableInternal/derived'; | ||
import 'vscode/vscode/vs/base/common/observableInternal/autorun'; | ||
import 'vscode/vscode/vs/base/common/observableInternal/utils'; | ||
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation'; | ||
import 'vscode/vscode/vs/base/common/arrays'; | ||
import { Disposable, DisposableStore, dispose, combinedDisposable } from 'vscode/vscode/vs/base/common/lifecycle'; | ||
@@ -8,3 +15,2 @@ import { ISCMService, ISCMViewService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm.service'; | ||
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js'; | ||
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation'; | ||
import { MarshalledId } from 'vscode/vscode/vs/base/common/marshallingIds'; | ||
@@ -21,2 +27,3 @@ import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables'; | ||
import { Schemas } from 'vscode/vscode/vs/base/common/network'; | ||
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service'; | ||
@@ -38,2 +45,7 @@ function getIconFromIconDto(iconDto) { | ||
} | ||
function toISCMHistoryItem(historyItemDto) { | ||
const icon = getIconFromIconDto(historyItemDto.icon); | ||
const labels = historyItemDto.labels?.map(l => ({ title: l.title, icon: getIconFromIconDto(l.icon) })); | ||
return { ...historyItemDto, icon, labels }; | ||
} | ||
class SCMInputBoxContentProvider extends Disposable { | ||
@@ -134,2 +146,3 @@ constructor(textModelService, modelService, languageService) { | ||
} | ||
get currentHistoryItemGroupObs() { return this._currentHistoryItemGroupObs; } | ||
constructor(proxy, handle) { | ||
@@ -140,2 +153,3 @@ this.proxy = proxy; | ||
this.onDidChangeCurrentHistoryItemGroup = this._onDidChangeCurrentHistoryItemGroup.event; | ||
this._currentHistoryItemGroupObs = observableValue(this, undefined); | ||
} | ||
@@ -147,7 +161,11 @@ async resolveHistoryItemGroupCommonAncestor(historyItemGroupId1, historyItemGroupId2) { | ||
const historyItems = await this.proxy.$provideHistoryItems(this.handle, historyItemGroupId, options, CancellationToken.None); | ||
return historyItems?.map(historyItem => ({ ...historyItem, icon: getIconFromIconDto(historyItem.icon) })); | ||
return historyItems?.map(historyItem => toISCMHistoryItem(historyItem)); | ||
} | ||
async provideHistoryItems2(options) { | ||
const historyItems = await this.proxy.$provideHistoryItems2(this.handle, options, CancellationToken.None); | ||
return historyItems?.map(historyItem => toISCMHistoryItem(historyItem)); | ||
} | ||
async provideHistoryItemSummary(historyItemId, historyItemParentId) { | ||
const historyItem = await this.proxy.$provideHistoryItemSummary(this.handle, historyItemId, historyItemParentId, CancellationToken.None); | ||
return historyItem ? { ...historyItem, icon: getIconFromIconDto(historyItem.icon) } : undefined; | ||
return historyItem ? toISCMHistoryItem(historyItem) : undefined; | ||
} | ||
@@ -163,2 +181,5 @@ async provideHistoryItemChanges(historyItemId, historyItemParentId) { | ||
} | ||
$onDidChangeCurrentHistoryItemGroup(historyItemGroup) { | ||
this._currentHistoryItemGroupObs.set(historyItemGroup, undefined); | ||
} | ||
} | ||
@@ -173,11 +194,11 @@ class MainThreadSCMProvider { | ||
get contextValue() { return this._providerId; } | ||
get commitTemplate() { return this.features.commitTemplate || ''; } | ||
get historyProvider() { return this._historyProvider; } | ||
get acceptInputCommand() { return this.features.acceptInputCommand; } | ||
get actionButton() { return this.features.actionButton ?? undefined; } | ||
get statusBarCommands() { return this.features.statusBarCommands; } | ||
get count() { return this.features.count; } | ||
get count() { return this._count; } | ||
get statusBarCommands() { return this._statusBarCommands; } | ||
get name() { return this._name ?? this._label; } | ||
get onDidChangeStatusBarCommands() { return this._onDidChangeStatusBarCommands.event; } | ||
constructor(proxy, _handle, _providerId, _label, _rootUri, _inputBoxTextModel, _quickDiffService, _uriIdentService, _workspaceContextService) { | ||
get commitTemplate() { return this._commitTemplate; } | ||
get historyProviderObs() { return this._historyProviderObs; } | ||
constructor(proxy, _handle, _providerId, _label, _rootUri, _inputBoxTextModel, _quickDiffService, _uriIdentService, _workspaceContextService, _logService) { | ||
this.proxy = proxy; | ||
@@ -192,2 +213,3 @@ this._handle = _handle; | ||
this._workspaceContextService = _workspaceContextService; | ||
this._logService = _logService; | ||
this._id = `scm${MainThreadSCMProvider.ID_HANDLE++}`; | ||
@@ -201,5 +223,5 @@ this.groups = []; | ||
this.features = {}; | ||
this._onDidChangeCommitTemplate = ( new Emitter()); | ||
this.onDidChangeCommitTemplate = this._onDidChangeCommitTemplate.event; | ||
this._onDidChangeStatusBarCommands = ( new Emitter()); | ||
this._count = observableValue(this, undefined); | ||
this._statusBarCommands = observableValue(this, undefined); | ||
this._commitTemplate = observableValue(this, ''); | ||
this._onDidChangeHistoryProvider = ( new Emitter()); | ||
@@ -210,2 +232,3 @@ this.onDidChangeHistoryProvider = this._onDidChangeHistoryProvider.event; | ||
this.isSCM = true; | ||
this._historyProviderObs = observableValue(this, undefined); | ||
if (_rootUri) { | ||
@@ -225,6 +248,10 @@ const folder = this._workspaceContextService.getWorkspaceFolder(_rootUri); | ||
if (typeof features.commitTemplate !== 'undefined') { | ||
this._onDidChangeCommitTemplate.fire(this.commitTemplate); | ||
this._commitTemplate.set(features.commitTemplate, undefined); | ||
} | ||
if (typeof features.count !== 'undefined') { | ||
this._count.set(features.count, undefined); | ||
} | ||
if (typeof features.statusBarCommands !== 'undefined') { | ||
this._onDidChangeStatusBarCommands.fire(this.statusBarCommands); | ||
this._logService.trace(`MainThreadSCMProvider#updateSourceControl (${this._id}): ${( features.statusBarCommands.map(c => c.title)).join(', ')}`); | ||
this._statusBarCommands.set(features.statusBarCommands, undefined); | ||
} | ||
@@ -244,6 +271,9 @@ if (features.hasQuickDiffProvider && !this._quickDiff) { | ||
if (features.hasHistoryProvider && !this._historyProvider) { | ||
this._historyProvider = ( new MainThreadSCMHistoryProvider(this.proxy, this.handle)); | ||
const historyProvider = ( new MainThreadSCMHistoryProvider(this.proxy, this.handle)); | ||
this._historyProviderObs.set(historyProvider, undefined); | ||
this._historyProvider = historyProvider; | ||
this._onDidChangeHistoryProvider.fire(); | ||
} | ||
else if (features.hasHistoryProvider === false && this._historyProvider) { | ||
this._historyProviderObs.set(undefined, undefined); | ||
this._historyProvider = undefined; | ||
@@ -346,2 +376,3 @@ this._onDidChangeHistoryProvider.fire(); | ||
this._historyProvider.currentHistoryItemGroup = currentHistoryItemGroup ?? undefined; | ||
this._historyProviderObs.get()?.$onDidChangeCurrentHistoryItemGroup(currentHistoryItemGroup); | ||
} | ||
@@ -359,3 +390,3 @@ toJSON() { | ||
let MainThreadSCM = class MainThreadSCM { | ||
constructor(extHostContext, scmService, scmViewService, languageService, modelService, textModelService, quickDiffService, _uriIdentService, workspaceContextService) { | ||
constructor(extHostContext, scmService, scmViewService, languageService, modelService, textModelService, quickDiffService, _uriIdentService, workspaceContextService, logService) { | ||
this.scmService = scmService; | ||
@@ -369,3 +400,5 @@ this.scmViewService = scmViewService; | ||
this.workspaceContextService = workspaceContextService; | ||
this.logService = logService; | ||
this._repositories = ( new Map()); | ||
this._repositoryBarriers = ( new Map()); | ||
this._repositoryDisposables = ( new Map()); | ||
@@ -384,2 +417,3 @@ this._disposables = ( new DisposableStore()); | ||
async $registerSourceControl(handle, id, label, rootUri, inputBoxDocumentUri) { | ||
this._repositoryBarriers.set(handle, ( new Barrier())); | ||
const inputBoxTextModelRef = await this.textModelService.createModelReference(URI.revive(inputBoxDocumentUri)); | ||
@@ -395,3 +429,4 @@ const provider = ( new MainThreadSCMProvider( | ||
this._uriIdentService, | ||
this.workspaceContextService | ||
this.workspaceContextService, | ||
this.logService | ||
)); | ||
@@ -401,2 +436,3 @@ const repository = this.scmService.registerSCMProvider(provider); | ||
const disposable = combinedDisposable(inputBoxTextModelRef, Event.filter(this.scmViewService.onDidFocusRepository, r => r === repository)(_ => this._proxy.$setSelectedSourceControl(handle)), repository.input.onDidChange(({ value }) => this._proxy.$onInputBoxValueChange(handle, value))); | ||
this._repositoryDisposables.set(handle, disposable); | ||
if (this.scmViewService.focusedRepository === repository) { | ||
@@ -408,5 +444,6 @@ setTimeout(() => this._proxy.$setSelectedSourceControl(handle), 0); | ||
} | ||
this._repositoryDisposables.set(handle, disposable); | ||
this._repositoryBarriers.get(handle)?.open(); | ||
} | ||
$updateSourceControl(handle, features) { | ||
async $updateSourceControl(handle, features) { | ||
await this._repositoryBarriers.get(handle)?.wait(); | ||
const repository = this._repositories.get(handle); | ||
@@ -419,3 +456,4 @@ if (!repository) { | ||
} | ||
$unregisterSourceControl(handle) { | ||
async $unregisterSourceControl(handle) { | ||
await this._repositoryBarriers.get(handle)?.wait(); | ||
const repository = this._repositories.get(handle); | ||
@@ -430,3 +468,4 @@ if (!repository) { | ||
} | ||
$registerGroups(sourceControlHandle, groups, splices) { | ||
async $registerGroups(sourceControlHandle, groups, splices) { | ||
await this._repositoryBarriers.get(sourceControlHandle)?.wait(); | ||
const repository = this._repositories.get(sourceControlHandle); | ||
@@ -440,3 +479,4 @@ if (!repository) { | ||
} | ||
$updateGroup(sourceControlHandle, groupHandle, features) { | ||
async $updateGroup(sourceControlHandle, groupHandle, features) { | ||
await this._repositoryBarriers.get(sourceControlHandle)?.wait(); | ||
const repository = this._repositories.get(sourceControlHandle); | ||
@@ -449,3 +489,4 @@ if (!repository) { | ||
} | ||
$updateGroupLabel(sourceControlHandle, groupHandle, label) { | ||
async $updateGroupLabel(sourceControlHandle, groupHandle, label) { | ||
await this._repositoryBarriers.get(sourceControlHandle)?.wait(); | ||
const repository = this._repositories.get(sourceControlHandle); | ||
@@ -458,3 +499,4 @@ if (!repository) { | ||
} | ||
$spliceResourceStates(sourceControlHandle, splices) { | ||
async $spliceResourceStates(sourceControlHandle, splices) { | ||
await this._repositoryBarriers.get(sourceControlHandle)?.wait(); | ||
const repository = this._repositories.get(sourceControlHandle); | ||
@@ -467,3 +509,4 @@ if (!repository) { | ||
} | ||
$unregisterGroup(sourceControlHandle, handle) { | ||
async $unregisterGroup(sourceControlHandle, handle) { | ||
await this._repositoryBarriers.get(sourceControlHandle)?.wait(); | ||
const repository = this._repositories.get(sourceControlHandle); | ||
@@ -476,3 +519,4 @@ if (!repository) { | ||
} | ||
$setInputBoxValue(sourceControlHandle, value) { | ||
async $setInputBoxValue(sourceControlHandle, value) { | ||
await this._repositoryBarriers.get(sourceControlHandle)?.wait(); | ||
const repository = this._repositories.get(sourceControlHandle); | ||
@@ -484,3 +528,4 @@ if (!repository) { | ||
} | ||
$setInputBoxPlaceholder(sourceControlHandle, placeholder) { | ||
async $setInputBoxPlaceholder(sourceControlHandle, placeholder) { | ||
await this._repositoryBarriers.get(sourceControlHandle)?.wait(); | ||
const repository = this._repositories.get(sourceControlHandle); | ||
@@ -492,3 +537,4 @@ if (!repository) { | ||
} | ||
$setInputBoxEnablement(sourceControlHandle, enabled) { | ||
async $setInputBoxEnablement(sourceControlHandle, enabled) { | ||
await this._repositoryBarriers.get(sourceControlHandle)?.wait(); | ||
const repository = this._repositories.get(sourceControlHandle); | ||
@@ -500,3 +546,4 @@ if (!repository) { | ||
} | ||
$setInputBoxVisibility(sourceControlHandle, visible) { | ||
async $setInputBoxVisibility(sourceControlHandle, visible) { | ||
await this._repositoryBarriers.get(sourceControlHandle)?.wait(); | ||
const repository = this._repositories.get(sourceControlHandle); | ||
@@ -508,3 +555,4 @@ if (!repository) { | ||
} | ||
$showValidationMessage(sourceControlHandle, message, type) { | ||
async $showValidationMessage(sourceControlHandle, message, type) { | ||
await this._repositoryBarriers.get(sourceControlHandle)?.wait(); | ||
const repository = this._repositories.get(sourceControlHandle); | ||
@@ -516,3 +564,4 @@ if (!repository) { | ||
} | ||
$setValidationProviderIsEnabled(sourceControlHandle, enabled) { | ||
async $setValidationProviderIsEnabled(sourceControlHandle, enabled) { | ||
await this._repositoryBarriers.get(sourceControlHandle)?.wait(); | ||
const repository = this._repositories.get(sourceControlHandle); | ||
@@ -532,3 +581,4 @@ if (!repository) { | ||
} | ||
$onDidChangeHistoryProviderCurrentHistoryItemGroup(sourceControlHandle, historyItemGroup) { | ||
async $onDidChangeHistoryProviderCurrentHistoryItemGroup(sourceControlHandle, historyItemGroup) { | ||
await this._repositoryBarriers.get(sourceControlHandle)?.wait(); | ||
const repository = this._repositories.get(sourceControlHandle); | ||
@@ -551,5 +601,6 @@ if (!repository) { | ||
( __param(7, IUriIdentityService)), | ||
( __param(8, IWorkspaceContextService)) | ||
( __param(8, IWorkspaceContextService)), | ||
( __param(9, ILogService)) | ||
], MainThreadSCM); | ||
export { MainThreadSCM }; |
@@ -109,3 +109,3 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
value = ( new TestCoverage(run, taskId, this.uriIdentityService, { | ||
getCoverageDetails: (id, token) => this.proxy.$getCoverageDetails(id, token) | ||
getCoverageDetails: (id, testId, token) => this.proxy.$getCoverageDetails(id, testId, token) | ||
.then(r => ( r.map(CoverageDetails.deserialize))), | ||
@@ -112,0 +112,0 @@ })); |
@@ -6,3 +6,2 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service'; | ||
import { ExtensionType } from 'vscode/vscode/vs/platform/extensions/common/extensions'; | ||
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service'; | ||
@@ -57,12 +56,2 @@ import 'vscode/vscode/vs/platform/instantiation/common/extensions'; | ||
} | ||
async _scanSingleExtension(extension) { | ||
if (extension.location.scheme === Schemas.vscodeRemote) { | ||
return this._remoteExtensionsScannerService.scanSingleExtension(extension.location, extension.type === ExtensionType.System); | ||
} | ||
const scannedExtension = await this._webExtensionsScannerService.scanExistingExtension(extension.location, extension.type, this._userDataProfileService.currentProfile.extensionsResource); | ||
if (scannedExtension) { | ||
return toExtensionDescription(scannedExtension); | ||
} | ||
return null; | ||
} | ||
_initFetchFileSystem() { | ||
@@ -69,0 +58,0 @@ const provider = ( new FetchFileSystemProvider()); |
@@ -6,3 +6,3 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent'; | ||
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle'; | ||
import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle'; | ||
import { Schemas } from 'vscode/vscode/vs/base/common/network'; | ||
@@ -44,3 +44,3 @@ import { mark } from 'vscode/vscode/vs/base/common/performance'; | ||
import { ExtensionRunningLocationTracker, filterExtensionIdentifiers } from './extensionRunningLocationTracker.js'; | ||
import { ExtensionHostStartup, ActivationKind, ExtensionPointContribution, ActivationTimes, toExtension } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions'; | ||
import { toExtensionDescription, ExtensionHostStartup, ActivationKind, ExtensionPointContribution, ActivationTimes, toExtension } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions'; | ||
import { ExtensionsRegistry, ExtensionMessageCollector } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry'; | ||
@@ -101,3 +101,3 @@ import { LazyCreateExtensionHostManager } from './lazyCreateExtensionHostManager.js'; | ||
this._inHandleDeltaExtensions = false; | ||
this._extensionHostManagers = []; | ||
this._extensionHostManagers = this._register(( (new ExtensionHostCollection()))); | ||
this._resolveAuthorityAttempt = 0; | ||
@@ -178,12 +178,4 @@ this._register(this._fileService.onWillActivateFileSystemProvider(e => { | ||
_getExtensionHostManagers(kind) { | ||
return this._extensionHostManagers.filter(extHostManager => extHostManager.kind === kind); | ||
return this._extensionHostManagers.getByKind(kind); | ||
} | ||
_getExtensionHostManagerByRunningLocation(runningLocation) { | ||
for (const extensionHostManager of this._extensionHostManagers) { | ||
if (extensionHostManager.representsRunningLocation(runningLocation)) { | ||
return extensionHostManager; | ||
} | ||
} | ||
return null; | ||
} | ||
async _handleDeltaExtensions(item) { | ||
@@ -233,3 +225,3 @@ this._deltaExtensionsQueue.push(item); | ||
const extension = _toAdd[i]; | ||
const extensionDescription = await this._scanSingleExtension(extension); | ||
const extensionDescription = toExtensionDescription(extension, false); | ||
if (!extensionDescription) { | ||
@@ -466,3 +458,3 @@ continue; | ||
if (runningLocation !== null) { | ||
return this._getExtensionHostManagerByRunningLocation(runningLocation); | ||
return this._extensionHostManagers.getByRunningLocation(runningLocation); | ||
} | ||
@@ -556,4 +548,4 @@ return null; | ||
} | ||
stopExtensionHosts(reason) { | ||
return this._doStopExtensionHostsWithVeto(reason); | ||
stopExtensionHosts(reason, auto) { | ||
return this._doStopExtensionHostsWithVeto(reason, auto); | ||
} | ||
@@ -567,6 +559,3 @@ _doStopExtensionHosts() { | ||
} | ||
for (let i = this._extensionHostManagers.length - 1; i >= 0; i--) { | ||
this._extensionHostManagers[i].dispose(); | ||
} | ||
this._extensionHostManagers = []; | ||
this._extensionHostManagers.disposeAllInReverse(); | ||
for (const extensionStatus of ( (this._extensionStatus.values()))) { | ||
@@ -579,3 +568,3 @@ extensionStatus.clearRuntimeStatus(); | ||
} | ||
async _doStopExtensionHostsWithVeto(reason) { | ||
async _doStopExtensionHostsWithVeto(reason, auto) { | ||
const vetos = []; | ||
@@ -608,17 +597,19 @@ const vetoReasons = ( (new Set())); | ||
else { | ||
const vetoReasonsArray = Array.from(vetoReasons); | ||
this._logService.warn(`Extension host was not stopped because of veto (stop reason: ${reason}, veto reason: ${vetoReasonsArray.join(', ')})`); | ||
await this._dialogService.warn(( localizeWithPath(_moduleId, 3, "The following operation was blocked: {0}", reason)), vetoReasonsArray.length === 1 ? | ||
( localizeWithPath( | ||
_moduleId, | ||
4, | ||
"The reason for blocking the operation: {0}", | ||
vetoReasonsArray[0] | ||
)) : | ||
( localizeWithPath( | ||
_moduleId, | ||
5, | ||
"The reasons for blocking the operation:\n- {0}", | ||
vetoReasonsArray.join('\n -') | ||
))); | ||
if (!auto) { | ||
const vetoReasonsArray = Array.from(vetoReasons); | ||
this._logService.warn(`Extension host was not stopped because of veto (stop reason: ${reason}, veto reason: ${vetoReasonsArray.join(', ')})`); | ||
await this._dialogService.warn(( localizeWithPath(_moduleId, 3, "The following operation was blocked: {0}", reason)), vetoReasonsArray.length === 1 ? | ||
( localizeWithPath( | ||
_moduleId, | ||
4, | ||
"The reason for blocking the operation: {0}", | ||
vetoReasonsArray[0] | ||
)) : | ||
( localizeWithPath( | ||
_moduleId, | ||
5, | ||
"The reasons for blocking the operation:\n- {0}", | ||
vetoReasonsArray.join('\n -') | ||
))); | ||
} | ||
} | ||
@@ -637,8 +628,9 @@ return !veto; | ||
for (const location of locations) { | ||
if (this._getExtensionHostManagerByRunningLocation(location)) { | ||
if (this._extensionHostManagers.getByRunningLocation(location)) { | ||
continue; | ||
} | ||
const extHostManager = this._createExtensionHostManager(location, isInitialStart, initialActivationEvents); | ||
if (extHostManager) { | ||
this._extensionHostManagers.push(extHostManager); | ||
const res = this._createExtensionHostManager(location, isInitialStart, initialActivationEvents); | ||
if (res) { | ||
const [extHostManager, disposableStore] = res; | ||
this._extensionHostManagers.add(extHostManager, disposableStore); | ||
} | ||
@@ -653,4 +645,5 @@ } | ||
const processManager = this._doCreateExtensionHostManager(extensionHost, initialActivationEvents); | ||
processManager.onDidExit(([code, signal]) => this._onExtensionHostCrashOrExit(processManager, code, signal)); | ||
processManager.onDidChangeResponsiveState((responsiveState) => { | ||
const disposableStore = ( (new DisposableStore())); | ||
disposableStore.add(processManager.onDidExit(([code, signal]) => this._onExtensionHostCrashOrExit(processManager, code, signal))); | ||
disposableStore.add(processManager.onDidChangeResponsiveState((responsiveState) => { | ||
this._logService.info(`Extension host (${processManager.friendyName}) is ${responsiveState === ResponsiveState.Responsive ? 'responsive' : 'unresponsive'}.`); | ||
@@ -664,4 +657,4 @@ this._onDidChangeResponsiveChange.fire({ | ||
}); | ||
}); | ||
return processManager; | ||
})); | ||
return [processManager, disposableStore]; | ||
} | ||
@@ -692,9 +685,3 @@ _doCreateExtensionHostManager(extensionHost, initialActivationEvents) { | ||
} | ||
for (let i = 0; i < this._extensionHostManagers.length; i++) { | ||
if (this._extensionHostManagers[i] === extensionHost) { | ||
this._extensionHostManagers[i].dispose(); | ||
this._extensionHostManagers.splice(i, 1); | ||
break; | ||
} | ||
} | ||
this._extensionHostManagers.disposeOne(extensionHost); | ||
} | ||
@@ -1012,2 +999,67 @@ } | ||
], AbstractExtensionService))); | ||
class ExtensionHostCollection extends Disposable { | ||
constructor() { | ||
super(...arguments); | ||
this._extensionHostManagers = []; | ||
} | ||
dispose() { | ||
this.disposeAllInReverse(); | ||
super.dispose(); | ||
} | ||
add(extensionHostManager, disposableStore) { | ||
this._extensionHostManagers.push(( (new ExtensionHostManagerData(extensionHostManager, disposableStore)))); | ||
} | ||
disposeAllInReverse() { | ||
for (let i = this._extensionHostManagers.length - 1; i >= 0; i--) { | ||
this._extensionHostManagers[i].dispose(); | ||
} | ||
this._extensionHostManagers = []; | ||
} | ||
disposeOne(extensionHostManager) { | ||
const index = this._extensionHostManagers.findIndex(el => el.extensionHost === extensionHostManager); | ||
if (index >= 0) { | ||
this._extensionHostManagers.splice(index, 1); | ||
extensionHostManager.dispose(); | ||
} | ||
} | ||
getByKind(kind) { | ||
return this.filter(el => el.kind === kind); | ||
} | ||
getByRunningLocation(runningLocation) { | ||
for (const el of this._extensionHostManagers) { | ||
if (el.extensionHost.representsRunningLocation(runningLocation)) { | ||
return el.extensionHost; | ||
} | ||
} | ||
return null; | ||
} | ||
*[Symbol.iterator]() { | ||
for (const extensionHostManager of this._extensionHostManagers) { | ||
yield extensionHostManager.extensionHost; | ||
} | ||
} | ||
map(callback) { | ||
return ( | ||
(this._extensionHostManagers.map(el => callback(el.extensionHost))) | ||
); | ||
} | ||
every(callback) { | ||
return this._extensionHostManagers.every(el => callback(el.extensionHost)); | ||
} | ||
filter(callback) { | ||
return ( | ||
(this._extensionHostManagers.filter(el => callback(el.extensionHost)).map(el => el.extensionHost)) | ||
); | ||
} | ||
} | ||
class ExtensionHostManagerData { | ||
constructor(extensionHost, disposableStore) { | ||
this.extensionHost = extensionHost; | ||
this.disposableStore = disposableStore; | ||
} | ||
dispose() { | ||
this.disposableStore.dispose(); | ||
this.extensionHost.dispose(); | ||
} | ||
} | ||
class ResolvedExtensions { | ||
@@ -1014,0 +1066,0 @@ constructor(local, remote, hasLocalProcess, allowRemoteExtensionsInLocalWebWorker) { |
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
import { isNonEmptyArray } from 'vscode/vscode/vs/base/common/arrays'; | ||
import { localizeWithPath } from 'vscode/vscode/vs/nls'; | ||
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle'; | ||
import { ExtensionIdentifier } from 'vscode/vscode/vs/platform/extensions/common/extensions'; | ||
import { allApiProposals } from 'vscode/vscode/vs/platform/extensions/common/extensionsApiProposals'; | ||
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors'; | ||
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service'; | ||
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service'; | ||
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform'; | ||
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service'; | ||
import { allApiProposals } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsApiProposals'; | ||
import { Extensions } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionFeatures'; | ||
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent'; | ||
const _moduleId = "vs/workbench/services/extensions/common/extensionsProposedApi"; | ||
let ExtensionsProposedApi = class ExtensionsProposedApi { | ||
@@ -13,3 +20,5 @@ constructor(_logService, _environmentService, productService) { | ||
this._environmentService = _environmentService; | ||
this._envEnabledExtensions = ( new Set(( (_environmentService.extensionEnabledProposedApi ?? []).map(id => ExtensionIdentifier.toKey(id))))); | ||
this._envEnabledExtensions = ( (new Set( | ||
((_environmentService.extensionEnabledProposedApi ?? []).map(id => ExtensionIdentifier.toKey(id))) | ||
))); | ||
this._envEnablesProposedApiForAll = | ||
@@ -19,3 +28,3 @@ !_environmentService.isBuilt || | ||
(this._envEnabledExtensions.size === 0 && Array.isArray(_environmentService.extensionEnabledProposedApi)); | ||
this._productEnabledExtensions = ( new Map()); | ||
this._productEnabledExtensions = ( (new Map())); | ||
if (productService.extensionEnabledApiProposals) { | ||
@@ -40,5 +49,4 @@ for (const [k, value] of Object.entries(productService.extensionEnabledApiProposals)) { | ||
} | ||
doUpdateEnabledApiProposals(_extension) { | ||
const extension = _extension; | ||
const key = ExtensionIdentifier.toKey(_extension.identifier); | ||
doUpdateEnabledApiProposals(extension) { | ||
const key = ExtensionIdentifier.toKey(extension.identifier); | ||
if (isNonEmptyArray(extension.enabledApiProposals)) { | ||
@@ -53,7 +61,7 @@ extension.enabledApiProposals = extension.enabledApiProposals.filter(name => { | ||
} | ||
if (( this._productEnabledExtensions.has(key))) { | ||
if (( (this._productEnabledExtensions.has(key)))) { | ||
const productEnabledProposals = this._productEnabledExtensions.get(key); | ||
const productSet = ( new Set(productEnabledProposals)); | ||
const extensionSet = ( new Set(extension.enabledApiProposals)); | ||
const diff = ( new Set([...extensionSet].filter(a => !( productSet.has(a))))); | ||
const productSet = ( (new Set(productEnabledProposals))); | ||
const extensionSet = ( (new Set(extension.enabledApiProposals))); | ||
const diff = ( (new Set([...extensionSet].filter(a => !( (productSet.has(a))))))); | ||
if (diff.size > 0) { | ||
@@ -69,3 +77,3 @@ this._logService.error(`Extension '${key}' appears in product.json but enables LESS API proposals than the extension wants.\npackage.json (LOSES): ${[...extensionSet].join(', ')}\nproduct.json (WINS): ${[...productSet].join(', ')}`); | ||
} | ||
if (this._envEnablesProposedApiForAll || ( this._envEnabledExtensions.has(key))) { | ||
if (this._envEnablesProposedApiForAll || ( (this._envEnabledExtensions.has(key)))) { | ||
return; | ||
@@ -79,8 +87,38 @@ } | ||
}; | ||
ExtensionsProposedApi = ( __decorate([ | ||
( __param(0, ILogService)), | ||
( __param(1, IWorkbenchEnvironmentService)), | ||
( __param(2, IProductService)) | ||
], ExtensionsProposedApi)); | ||
ExtensionsProposedApi = ( (__decorate([ | ||
( (__param(0, ILogService))), | ||
( (__param(1, IWorkbenchEnvironmentService))), | ||
( (__param(2, IProductService))) | ||
], ExtensionsProposedApi))); | ||
class ApiProposalsMarkdowneRenderer extends Disposable { | ||
constructor() { | ||
super(...arguments); | ||
this.type = 'markdown'; | ||
} | ||
shouldRender(manifest) { | ||
return !!manifest.enabledApiProposals?.length; | ||
} | ||
render(manifest) { | ||
const enabledApiProposals = manifest.enabledApiProposals || []; | ||
const data = ( (new MarkdownString())); | ||
if (enabledApiProposals.length) { | ||
for (const proposal of enabledApiProposals) { | ||
data.appendMarkdown(`- \`${proposal}\`\n`); | ||
} | ||
} | ||
return { | ||
data, | ||
dispose: () => { } | ||
}; | ||
} | ||
} | ||
( (Registry.as(Extensions.ExtensionFeaturesRegistry))).registerExtensionFeature({ | ||
id: 'enabledApiProposals', | ||
label: ( localizeWithPath(_moduleId, 0, "API Proposals")), | ||
access: { | ||
canToggle: false | ||
}, | ||
renderer: ( (new SyncDescriptor(ApiProposalsMarkdowneRenderer))), | ||
}); | ||
export { ExtensionsProposedApi }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
885198
110
18355
+ Added@codingame/monaco-vscode-api@7.0.0(transitive)
+ Added@codingame/monaco-vscode-base-service-override@7.0.0(transitive)
+ Added@codingame/monaco-vscode-environment-service-override@7.0.0(transitive)
+ Added@codingame/monaco-vscode-files-service-override@7.0.0(transitive)
+ Added@codingame/monaco-vscode-host-service-override@7.0.0(transitive)
+ Added@codingame/monaco-vscode-layout-service-override@7.0.0(transitive)
+ Added@codingame/monaco-vscode-quickaccess-service-override@7.0.0(transitive)
+ Addedjschardet@3.1.2(transitive)
- Removed@codingame/monaco-vscode-api@6.0.3(transitive)
- Removed@codingame/monaco-vscode-base-service-override@6.0.3(transitive)
- Removed@codingame/monaco-vscode-environment-service-override@6.0.3(transitive)
- Removed@codingame/monaco-vscode-files-service-override@6.0.3(transitive)
- Removed@codingame/monaco-vscode-host-service-override@6.0.3(transitive)
- Removed@codingame/monaco-vscode-layout-service-override@6.0.3(transitive)
- Removed@codingame/monaco-vscode-quickaccess-service-override@6.0.3(transitive)
- Removedjschardet@3.0.0(transitive)
Updated@codingame/monaco-vscode-files-service-override@7.0.0