@codingame/monaco-vscode-api
Advanced tools
Comparing version 1.69.10 to 1.69.11
@@ -1,4 +0,5 @@ | ||
import { E as Emitter } from './polyfill.js'; | ||
import './polyfill.js'; | ||
import { B as Breakpoint$1, C as CallHierarchyIncomingCall$1, a as CallHierarchyItem$1, b as CallHierarchyOutgoingCall$1, c as CodeAction$1, d as CodeActionKind$1, e as CodeActionTriggerKind$1, f as CodeLens$1, g as Color$1, h as ColorInformation$1, i as ColorPresentation$1, j as CommentMode$1, k as CommentThreadCollapsibleState$1, l as CompletionItem$1, m as CompletionItemKind$1, n as CompletionItemTag$1, o as CompletionList$1, p as CompletionTriggerKind$1, q as ConfigurationTarget$1, r as CustomExecution$1, D as DebugAdapterExecutable$1, s as DebugAdapterInlineImplementation$1, t as DebugAdapterNamedPipeServer$1, u as DebugAdapterServer$1, v as DebugConsoleMode$1, w as DecorationRangeBehavior$1, x as Diagnostic$1, y as DiagnosticRelatedInformation$1, z as DiagnosticSeverity$1, A as DiagnosticTag$1, E as Disposable$1, F as DocumentHighlight$1, G as DocumentHighlightKind$1, H as DocumentLink$1, I as DocumentSymbol$1, J as EndOfLine$1, K as EnvironmentVariableMutatorType$1, L as EvaluatableExpression$1, M as InlineValueText$1, N as InlineValueVariableLookup$1, O as InlineValueEvaluatableExpression$1, P as ExtensionKind$1, Q as ExtensionMode$1, R as FileChangeType$1, S as FileDecoration$1, T as FileSystemError$1, U as FoldingRange$1, V as FoldingRangeKind$1, W as FunctionBreakpoint$1, X as Hover$1, Y as Location$1, Z as MarkdownString$1, _ as ParameterInformation$1, $ as Position$1, a0 as ProcessExecution$1, a1 as ProgressLocation$1, a2 as QuickInputButtons$1, a3 as Range$1, a4 as RelativePattern$1, a5 as Selection$2, a6 as SelectionRange$1, a7 as SemanticTokens$1, a8 as SemanticTokensBuilder$1, a9 as SemanticTokensEdit$1, aa as SemanticTokensEdits$1, ab as SemanticTokensLegend$1, ac as ShellExecution$1, ad as ShellQuoting$1, ae as SignatureHelp$1, af as SignatureHelpTriggerKind$1, ag as SignatureInformation$1, ah as SnippetString$1, ai as SourceBreakpoint$1, aj as StatusBarAlignment$1, ak as SymbolInformation$1, al as SymbolKind$1, am as SymbolTag$1, an as Task$1, ao as TaskGroup$1, ap as TaskPanelKind$1, aq as TaskRevealKind$1, ar as TaskScope$1, as as TerminalLink$1, at as TerminalLocation$1, au as TerminalProfile$1, av as TextDocumentSaveReason$1, aw as TextEdit$1, ax as TextEditorLineNumbersStyle$1, ay as TextEditorRevealType$1, az as TextEditorSelectionChangeKind$1, aA as TextDocumentChangeReason$1, aB as ThemeColor$1, aC as ThemeIcon$1, aD as TreeItem$1, aE as TreeItemCollapsibleState$1, aF as TypeHierarchyItem$1, aG as UIKind$1, aH as ViewColumn$1, aI as WorkspaceEdit$1, aJ as InlayHint$1, aK as InlayHintLabelPart$1, aL as InlayHintKind$1, aM as NotebookRange$1, aN as NotebookCellKind$1, aO as NotebookCellData$1, aP as NotebookData$1, aQ as NotebookCellStatusBarAlignment$1, aR as NotebookCellOutput$1, aS as NotebookCellOutputItem$1, aT as NotebookCellStatusBarItem$1, aU as NotebookControllerAffinity$1, aV as LinkedEditingRanges$1, aW as TestRunRequest$1, aX as TestMessage$1, aY as TestTag$1, aZ as TestRunProfileKind$1, a_ as LanguageStatusSeverity$1, a$ as QuickPickItemKind$1, b0 as TextDiffTabInput, b1 as CustomEditorTabInput, b2 as NotebookEditorTabInput, b3 as NotebookDiffEditorTabInput, b4 as WebviewEditorTabInput, b5 as TerminalEditorTabInput, b6 as InputBoxValidationSeverity$1, b7 as InlineSuggestionList, b8 as InlineCompletionTriggerKind$1, b9 as InlineSuggestion, ba as DocumentDropEdit$1, bb as NotebookEditorRevealType$1, bc as getExtHostServices, bd as DEFAULT_EXTENSION, be as LanguageSelector } from './extHost.js'; | ||
import { C as CancellationTokenSource$1, F as FileType$1, a as FilePermission$1, S as Services } from './services2.js'; | ||
import { E as Emitter } from './workspace.js'; | ||
import { score } from 'monaco-editor/esm/vs/editor/common/languageSelector.js'; | ||
@@ -5,0 +6,0 @@ import { u as unsupported$1 } from './missing-services.js'; |
@@ -1,4 +0,4 @@ | ||
import { _ as __decorate, a as __param } from './contextkey.js'; | ||
import { E as Emitter, U as UserSettings } from './polyfill.js'; | ||
import { e as IUserDataProfilesService, f as IPolicyService, N as NullPolicyService } from './missing-services.js'; | ||
import { E as Emitter, _ as __decorate, a as __param } from './workspace.js'; | ||
import { U as UserSettings } from './polyfill.js'; | ||
import { e as IPolicyService, N as NullPolicyService } from './missing-services.js'; | ||
import { b as isEmptyObject } from './types.js'; | ||
@@ -22,3 +22,3 @@ import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js'; | ||
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js'; | ||
import { i as IFileService, j as IWorkbenchEnvironmentService } from './services2.js'; | ||
import { q as IUserDataProfilesService, i as IFileService, j as IWorkbenchEnvironmentService } from './services2.js'; | ||
import { localize } from 'monaco-editor/esm/vs/nls.js'; | ||
@@ -25,0 +25,0 @@ import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js'; |
@@ -1,5 +0,5 @@ | ||
import { E as Emitter } from './polyfill.js'; | ||
import './polyfill.js'; | ||
import './missing-services.js'; | ||
import { g as getServiceOverride$1, D as DialogHandlerContribution } from './layout.js'; | ||
import { _ as __decorate, a as __param } from './contextkey.js'; | ||
import { _ as __decorate, a as __param, E as Emitter } from './workspace.js'; | ||
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js'; | ||
@@ -6,0 +6,0 @@ import { DeferredPromise } from 'monaco-editor/esm/vs/base/common/async.js'; |
@@ -1,5 +0,5 @@ | ||
import { _ as __decorate, a as __param } from './contextkey.js'; | ||
import { E as Emitter, a as isReadableStream, p as peekStream, b as peekReadable, c as bufferToReadable, s as streamToBuffer, e as consumeStream, t as transform, f as isReadableBufferedStream, l as listenStream, g as bufferedStreamToBuffer, h as readableToBuffer, n as newWriteableBufferStream, j as newWriteableStream } from './polyfill.js'; | ||
import { g as format2, h as getServiceMachineId, R as ResourceQueue, u as unsupported } from './missing-services.js'; | ||
import { i as IFileService, c as IProductService, S as Services, t as FileSystemProviderError, d as FileSystemProviderErrorCode, u as FileChangesEvent, v as FileOperationError, w as hasOpenReadWriteCloseCapability, x as hasReadWriteCapability, y as hasFileReadStreamCapability, z as toFileSystemProviderErrorCode, B as ensureFileSystemProviderError, F as FileType, a as FilePermission, D as etag, E as FileOperationEvent, G as toFileOperationResult, H as ETAG_DISABLED, J as hasFileAtomicReadCapability, N as NotModifiedSinceFileOperationError, K as hasFileFolderCopyCapability, L as hasFileCloneCapability, M as createFileSystemProviderError, C as CancellationTokenSource } from './services2.js'; | ||
import { _ as __decorate, a as __param, E as Emitter } from './workspace.js'; | ||
import { i as isReadableStream, p as peekStream, a as peekReadable, b as bufferToReadable, s as streamToBuffer, c as consumeStream, t as transform, e as isReadableBufferedStream, l as listenStream, f as bufferedStreamToBuffer, g as readableToBuffer, n as newWriteableBufferStream, h as newWriteableStream } from './polyfill.js'; | ||
import { f as format2, g as getServiceMachineId, R as ResourceQueue, u as unsupported } from './missing-services.js'; | ||
import { i as IFileService, c as IProductService, S as Services, w as FileSystemProviderError, d as FileSystemProviderErrorCode, x as FileChangesEvent, y as FileOperationError, z as hasOpenReadWriteCloseCapability, B as hasReadWriteCapability, D as hasFileReadStreamCapability, E as toFileSystemProviderErrorCode, G as ensureFileSystemProviderError, F as FileType, a as FilePermission, H as etag, J as FileOperationEvent, K as toFileOperationResult, L as ETAG_DISABLED, M as hasFileAtomicReadCapability, N as NotModifiedSinceFileOperationError, O as hasFileFolderCopyCapability, Q as hasFileCloneCapability, R as createFileSystemProviderError, C as CancellationTokenSource } from './services2.js'; | ||
import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js'; | ||
@@ -6,0 +6,0 @@ import { canceled } from 'monaco-editor/esm/vs/base/common/errors.js'; |
@@ -1,4 +0,4 @@ | ||
import { k as parse, m as getNodeType } from './polyfill.js'; | ||
import { n as ITextMateService, I as IExtensionService } from './missing-services.js'; | ||
import { _ as __decorate, a as __param } from './contextkey.js'; | ||
import { j as parse, k as getNodeType } from './polyfill.js'; | ||
import { m as ITextMateService, I as IExtensionService } from './missing-services.js'; | ||
import { _ as __decorate, a as __param } from './workspace.js'; | ||
import { g as getParseErrorMessage } from './jsonErrorMessages.js'; | ||
@@ -5,0 +5,0 @@ import { r as registerExtensionFile, g as getServiceOverride$1, I as IExtensionResourceLoaderService } from './files.js'; |
import './polyfill.js'; | ||
import { j as ExtensionMessageCollector } from './missing-services.js'; | ||
import { h as ExtensionMessageCollector } from './missing-services.js'; | ||
import { W as WorkbenchLanguageService } from './languageService.js'; | ||
@@ -4,0 +4,0 @@ import { g as getExtensionPoint, c as consoleExtensionMessageHandler } from './tools.js'; |
@@ -1,4 +0,4 @@ | ||
import { _ as __decorate, a as __param } from './contextkey.js'; | ||
import { _ as __decorate, a as __param } from './workspace.js'; | ||
import { I as IExtensionService, E as ExtensionsRegistry } from './missing-services.js'; | ||
import { O as FILES_ASSOCIATIONS_CONFIG } from './services2.js'; | ||
import { T as FILES_ASSOCIATIONS_CONFIG } from './services2.js'; | ||
import { parse } from 'monaco-editor/esm/vs/base/common/glob.js'; | ||
@@ -5,0 +5,0 @@ import { posix } from 'monaco-editor/esm/vs/base/common/path.js'; |
@@ -1,4 +0,4 @@ | ||
import { r as refineServiceDecorator } from './services2.js'; | ||
import { s as refineServiceDecorator } from './services2.js'; | ||
import { ILayoutService } from 'monaco-editor/esm/vs/platform/layout/browser/layoutService.js'; | ||
const IWorkbenchLayoutService = refineServiceDecorator(ILayoutService); | ||
export { IWorkbenchLayoutService as I }; |
@@ -1,3 +0,3 @@ | ||
import { _ as __decorate, a as __param } from './contextkey.js'; | ||
import { E as Emitter } from './polyfill.js'; | ||
import { _ as __decorate, a as __param, E as Emitter } from './workspace.js'; | ||
import './polyfill.js'; | ||
import { d as ILanguageDetectionService, u as unsupported } from './missing-services.js'; | ||
@@ -12,3 +12,3 @@ import { MutableDisposable, Disposable, ImmortalReference, dispose, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js'; | ||
import { IAccessibilityService } from 'monaco-editor/esm/vs/platform/accessibility/common/accessibility.js'; | ||
import { I as IEditorService, e as SIDE_GROUP, A as ACTIVE_GROUP, i as IFileService, f as IUriIdentityService, s as isPreferredGroup, h as ITextFileService } from './services2.js'; | ||
import { I as IEditorService, e as SIDE_GROUP, A as ACTIVE_GROUP, i as IFileService, f as IUriIdentityService, v as isPreferredGroup, h as ITextFileService } from './services2.js'; | ||
import { MultiModelEditStackElement } from 'monaco-editor/esm/vs/editor/common/model/editStack.js'; | ||
@@ -15,0 +15,0 @@ import { ITextModelService } from 'monaco-editor/esm/vs/editor/common/services/resolverService.js'; |
@@ -1,3 +0,3 @@ | ||
import { _ as __decorate, a as __param } from './contextkey.js'; | ||
export { C as ContextKeyExprType } from './contextkey.js'; | ||
import { _ as __decorate, a as __param } from './workspace.js'; | ||
export { C as ContextKeyExprType } from './workspace.js'; | ||
import './polyfill.js'; | ||
@@ -4,0 +4,0 @@ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js'; |
@@ -1,3 +0,3 @@ | ||
export { b as IEditorGroupsService, I as IEditorService, i as IFileService, o as IHostService, n as ILanguageStatusService, g as IPaneCompositePartService, l as IPathService, c as IProductService, q as ISnippetsService, h as ITextFileService, f as IUriIdentityService, j as IWorkbenchEnvironmentService, k as IWorkingCopyFileService, S as Services } from './services2.js'; | ||
export { C as ContextKeyExprType, f as NotificationsFilter } from './contextkey.js'; | ||
export { b as IEditorGroupsService, I as IEditorService, i as IFileService, o as IHostService, n as ILanguageStatusService, g as IPaneCompositePartService, l as IPathService, c as IProductService, r as ISnippetsService, h as ITextFileService, f as IUriIdentityService, j as IWorkbenchEnvironmentService, k as IWorkingCopyFileService, S as Services, t as StorageScope, u as StorageTarget } from './services2.js'; | ||
export { C as ContextKeyExprType, f as NotificationsFilter } from './workspace.js'; | ||
export { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js'; | ||
@@ -24,2 +24,3 @@ export { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js'; | ||
export { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js'; | ||
export { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js'; | ||
export { default as Severity } from 'monaco-editor/esm/vs/base/common/severity.js'; |
import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js'; | ||
import { IEnvironmentService } from 'monaco-editor/esm/vs/platform/environment/common/environment.js'; | ||
import './contextkey.js'; | ||
import { _ as __decorate, E as Emitter, i as isWorkspaceIdentifier, a as __param } from './workspace.js'; | ||
import { isSingleFolderWorkspaceIdentifier } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js'; | ||
import { joinPath } from 'monaco-editor/esm/vs/base/common/resources.js'; | ||
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js'; | ||
import { Disposable, MutableDisposable, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js'; | ||
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js'; | ||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js'; | ||
import { localize } from 'monaco-editor/esm/vs/nls.js'; | ||
import { TernarySearchTree } from 'monaco-editor/esm/vs/base/common/map.js'; | ||
import { Promises, RunOnceScheduler, runWhenIdle } from 'monaco-editor/esm/vs/base/common/async.js'; | ||
import { ResourceMap, TernarySearchTree } from 'monaco-editor/esm/vs/base/common/map.js'; | ||
import { hash } from 'monaco-editor/esm/vs/base/common/hash.js'; | ||
import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js'; | ||
import { isUndefinedOrNull, isUndefined } from 'monaco-editor/esm/vs/base/common/types.js'; | ||
import { PauseableEmitter } from 'monaco-editor/esm/vs/base/common/event.js'; | ||
function refineServiceDecorator(serviceIdentifier) { | ||
@@ -254,2 +264,566 @@ return serviceIdentifier; | ||
const IUriIdentityService = ( (createDecorator('IUriIdentityService'))); | ||
function isUserDataProfile(thing) { | ||
const candidate = thing; | ||
return !!(candidate && typeof candidate === 'object' | ||
&& typeof candidate.id === 'string' | ||
&& typeof candidate.isDefault === 'boolean' | ||
&& typeof candidate.name === 'string' | ||
&& URI.isUri(candidate.location) | ||
&& URI.isUri(candidate.globalStorageHome) | ||
&& URI.isUri(candidate.settingsResource) | ||
&& URI.isUri(candidate.keybindingsResource) | ||
&& URI.isUri(candidate.tasksResource) | ||
&& URI.isUri(candidate.snippetsHome) | ||
&& (isUndefined(candidate.extensionsResource) || URI.isUri(candidate.extensionsResource))); | ||
} | ||
const PROFILES_ENABLEMENT_CONFIG = 'workbench.experimental.settingsProfiles.enabled'; | ||
const IUserDataProfilesService = ( (createDecorator('IUserDataProfilesService'))); | ||
const EXTENSIONS_RESOURCE_NAME = 'extensions.json'; | ||
function toUserDataProfile(name, location, useDefaultFlags) { | ||
return { | ||
id: ( (hash(location.path).toString(16))), | ||
name: name, | ||
location: location, | ||
isDefault: false, | ||
globalStorageHome: joinPath(location, 'globalStorage'), | ||
settingsResource: joinPath(location, 'settings.json'), | ||
keybindingsResource: joinPath(location, 'keybindings.json'), | ||
tasksResource: joinPath(location, 'tasks.json'), | ||
snippetsHome: joinPath(location, 'snippets'), | ||
extensionsResource: joinPath(location, EXTENSIONS_RESOURCE_NAME), | ||
useDefaultFlags | ||
}; | ||
} | ||
let UserDataProfilesService = class UserDataProfilesService extends Disposable { | ||
constructor(environmentService, fileService, uriIdentityService, logService) { | ||
super(); | ||
this.environmentService = environmentService; | ||
this.fileService = fileService; | ||
this.uriIdentityService = uriIdentityService; | ||
this.logService = logService; | ||
this.enabled = false; | ||
this.defaultProfileShouldIncludeExtensionsResourceAlways = false; | ||
this._onDidChangeProfiles = this._register(( (new Emitter()))); | ||
this.onDidChangeProfiles = this._onDidChangeProfiles.event; | ||
this._onWillCreateProfile = this._register(( (new Emitter()))); | ||
this.onWillCreateProfile = this._onWillCreateProfile.event; | ||
this._onWillRemoveProfile = this._register(( (new Emitter()))); | ||
this.onWillRemoveProfile = this._onWillRemoveProfile.event; | ||
this.profilesHome = joinPath(this.environmentService.userRoamingDataHome, 'profiles'); | ||
} | ||
get defaultProfile() { return this.profiles[0]; } | ||
get profiles() { return this.profilesObject.profiles; } | ||
setEnablement(enabled) { | ||
if (this.enabled !== enabled) { | ||
this._profilesObject = undefined; | ||
this.enabled = enabled; | ||
} | ||
} | ||
get profilesObject() { | ||
if (!this._profilesObject) { | ||
const profiles = this.enabled ? this.getStoredProfiles().map(storedProfile => toUserDataProfile(storedProfile.name, storedProfile.location, storedProfile.useDefaultFlags)) : []; | ||
let emptyWindow; | ||
const workspaces = ( (new ResourceMap())); | ||
if (profiles.length) { | ||
const profileAssicaitions = this.getStoredProfileAssociations(); | ||
if (profileAssicaitions.workspaces) { | ||
for (const [workspacePath, profilePath] of Object.entries(profileAssicaitions.workspaces)) { | ||
const workspace = ( (URI.parse(workspacePath))); | ||
const profileLocation = ( (URI.parse(profilePath))); | ||
const profile = profiles.find(p => this.uriIdentityService.extUri.isEqual(p.location, profileLocation)); | ||
if (profile) { | ||
workspaces.set(workspace, profile); | ||
} | ||
} | ||
} | ||
if (profileAssicaitions.emptyWindow) { | ||
const emptyWindowProfileLocation = ( (URI.parse(profileAssicaitions.emptyWindow))); | ||
emptyWindow = profiles.find(p => this.uriIdentityService.extUri.isEqual(p.location, emptyWindowProfileLocation)); | ||
} | ||
} | ||
const profile = toUserDataProfile(( (localize('defaultProfile', "Default"))), this.environmentService.userRoamingDataHome); | ||
profiles.unshift({ ...profile, isDefault: true, extensionsResource: this.defaultProfileShouldIncludeExtensionsResourceAlways || profiles.length > 0 ? profile.extensionsResource : undefined }); | ||
this._profilesObject = { profiles, workspaces, emptyWindow }; | ||
} | ||
return this._profilesObject; | ||
} | ||
getProfile(workspaceIdentifier) { | ||
const workspace = this.getWorkspace(workspaceIdentifier); | ||
const profile = URI.isUri(workspace) ? this.profilesObject.workspaces.get(workspace) : this.profilesObject.emptyWindow; | ||
return profile ?? this.defaultProfile; | ||
} | ||
getWorkspace(workspaceIdentifier) { | ||
if (isSingleFolderWorkspaceIdentifier(workspaceIdentifier)) { | ||
return workspaceIdentifier.uri; | ||
} | ||
if (isWorkspaceIdentifier(workspaceIdentifier)) { | ||
return workspaceIdentifier.configPath; | ||
} | ||
return 'empty-window'; | ||
} | ||
async createProfile(name, useDefaultFlags, workspaceIdentifier) { | ||
if (!this.enabled) { | ||
throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`); | ||
} | ||
if (this.getStoredProfiles().some(p => p.name === name)) { | ||
throw new Error(`Profile with name ${name} already exists`); | ||
} | ||
const profile = toUserDataProfile(name, joinPath(this.profilesHome, ( (hash(generateUuid()).toString(16)))), useDefaultFlags); | ||
await this.fileService.createFolder(profile.location); | ||
const joiners = []; | ||
this._onWillCreateProfile.fire({ | ||
profile, | ||
join(promise) { | ||
joiners.push(promise); | ||
} | ||
}); | ||
await Promises.settled(joiners); | ||
this.updateProfiles([profile], [], []); | ||
if (workspaceIdentifier) { | ||
await this.setProfileForWorkspace(profile, workspaceIdentifier); | ||
} | ||
return profile; | ||
} | ||
async updateProfile(profileToUpdate, name, useDefaultFlags) { | ||
if (!this.enabled) { | ||
throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`); | ||
} | ||
let profile = this.profiles.find(p => p.id === profileToUpdate.id); | ||
if (!profile) { | ||
throw new Error(`Profile '${profileToUpdate.name}' does not exist`); | ||
} | ||
profile = toUserDataProfile(name, profile.location, useDefaultFlags); | ||
this.updateProfiles([], [], [profile]); | ||
return profile; | ||
} | ||
async setProfileForWorkspace(profileToSet, workspaceIdentifier) { | ||
if (!this.enabled) { | ||
throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`); | ||
} | ||
const profile = this.profiles.find(p => p.id === profileToSet.id); | ||
if (!profile) { | ||
throw new Error(`Profile '${profileToSet.name}' does not exist`); | ||
} | ||
this.updateWorkspaceAssociation(workspaceIdentifier, profile); | ||
} | ||
async unsetWorkspace(workspaceIdentifier) { | ||
if (!this.enabled) { | ||
throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`); | ||
} | ||
this.updateWorkspaceAssociation(workspaceIdentifier); | ||
} | ||
async removeProfile(profileToRemove) { | ||
if (!this.enabled) { | ||
throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`); | ||
} | ||
if (profileToRemove.isDefault) { | ||
throw new Error('Cannot remove default profile'); | ||
} | ||
const profile = this.profiles.find(p => p.id === profileToRemove.id); | ||
if (!profile) { | ||
throw new Error(`Profile '${profileToRemove.name}' does not exist`); | ||
} | ||
const joiners = []; | ||
this._onWillRemoveProfile.fire({ | ||
profile, | ||
join(promise) { | ||
joiners.push(promise); | ||
} | ||
}); | ||
await Promises.settled(joiners); | ||
if (profile.id === this.profilesObject.emptyWindow?.id) { | ||
this.profilesObject.emptyWindow = undefined; | ||
} | ||
for (const workspace of [...( (this.profilesObject.workspaces.keys()))]) { | ||
if (profile.id === this.profilesObject.workspaces.get(workspace)?.id) { | ||
this.profilesObject.workspaces.delete(workspace); | ||
} | ||
} | ||
this.updateStoredProfileAssociations(); | ||
this.updateProfiles([], [profile], []); | ||
try { | ||
if (this.profiles.length === 1) { | ||
await this.fileService.del(this.profilesHome, { recursive: true }); | ||
} | ||
else { | ||
await this.fileService.del(profile.location, { recursive: true }); | ||
} | ||
} | ||
catch (error) { | ||
this.logService.error(error); | ||
} | ||
} | ||
updateProfiles(added, removed, updated) { | ||
const storedProfiles = []; | ||
for (let profile of [...this.profilesObject.profiles, ...added]) { | ||
if (profile.isDefault) { | ||
continue; | ||
} | ||
if (removed.some(p => profile.id === p.id)) { | ||
continue; | ||
} | ||
profile = updated.find(p => profile.id === p.id) ?? profile; | ||
storedProfiles.push({ location: profile.location, name: profile.name, useDefaultFlags: profile.useDefaultFlags }); | ||
} | ||
this.saveStoredProfiles(storedProfiles); | ||
this._profilesObject = undefined; | ||
this.triggerProfilesChanges(added, removed, updated); | ||
} | ||
triggerProfilesChanges(added, removed, updated) { | ||
this._onDidChangeProfiles.fire({ added, removed, updated, all: this.profiles }); | ||
} | ||
updateWorkspaceAssociation(workspaceIdentifier, newProfile) { | ||
const workspace = this.getWorkspace(workspaceIdentifier); | ||
if (URI.isUri(workspace)) { | ||
this.profilesObject.workspaces.delete(workspace); | ||
if (newProfile && !newProfile.isDefault) { | ||
this.profilesObject.workspaces.set(workspace, newProfile); | ||
} | ||
} | ||
else { | ||
this.profilesObject.emptyWindow = !newProfile?.isDefault ? newProfile : undefined; | ||
} | ||
this.updateStoredProfileAssociations(); | ||
} | ||
updateStoredProfileAssociations() { | ||
const workspaces = {}; | ||
for (const [workspace, profile] of this.profilesObject.workspaces.entries()) { | ||
workspaces[( (workspace.toString()))] = ( (profile.location.toString())); | ||
} | ||
const emptyWindow = this.profilesObject.emptyWindow?.location.toString(); | ||
this.saveStoredProfileAssociations({ workspaces, emptyWindow }); | ||
this._profilesObject = undefined; | ||
} | ||
getStoredProfiles() { return []; } | ||
saveStoredProfiles(storedProfiles) { throw new Error('not implemented'); } | ||
getStoredProfileAssociations() { return {}; } | ||
saveStoredProfileAssociations(storedProfileAssociations) { throw new Error('not implemented'); } | ||
}; | ||
UserDataProfilesService.PROFILES_KEY = 'userDataProfiles'; | ||
UserDataProfilesService.PROFILE_ASSOCIATIONS_KEY = 'profileAssociations'; | ||
UserDataProfilesService = ( (__decorate([ | ||
( (__param(0, IEnvironmentService))), | ||
( (__param(1, IFileService))), | ||
( (__param(2, IUriIdentityService))), | ||
( (__param(3, ILogService))) | ||
], UserDataProfilesService))); | ||
const IS_NEW_KEY = '__$__isNewStorageMarker'; | ||
const TARGET_KEY = '__$__targetStorageMarker'; | ||
var WillSaveStateReason; | ||
( ((function(WillSaveStateReason) { | ||
WillSaveStateReason[WillSaveStateReason["NONE"] = 0] = "NONE"; | ||
WillSaveStateReason[WillSaveStateReason["SHUTDOWN"] = 1] = "SHUTDOWN"; | ||
})(WillSaveStateReason || (WillSaveStateReason = {})))); | ||
var StorageScope; | ||
( ((function(StorageScope) { | ||
StorageScope[StorageScope["APPLICATION"] = -1] = "APPLICATION"; | ||
StorageScope[StorageScope["PROFILE"] = 0] = "PROFILE"; | ||
StorageScope[StorageScope["WORKSPACE"] = 1] = "WORKSPACE"; | ||
})(StorageScope || (StorageScope = {})))); | ||
var StorageTarget; | ||
( ((function(StorageTarget) { | ||
StorageTarget[StorageTarget["USER"] = 0] = "USER"; | ||
StorageTarget[StorageTarget["MACHINE"] = 1] = "MACHINE"; | ||
})(StorageTarget || (StorageTarget = {})))); | ||
class AbstractStorageService extends Disposable { | ||
constructor(options = { flushInterval: AbstractStorageService.DEFAULT_FLUSH_INTERVAL }) { | ||
super(); | ||
this.options = options; | ||
this._onDidChangeValue = this._register(( (new PauseableEmitter()))); | ||
this.onDidChangeValue = this._onDidChangeValue.event; | ||
this._onDidChangeTarget = this._register(( (new PauseableEmitter()))); | ||
this.onDidChangeTarget = this._onDidChangeTarget.event; | ||
this._onWillSaveState = this._register(( (new Emitter()))); | ||
this.onWillSaveState = this._onWillSaveState.event; | ||
this.flushWhenIdleScheduler = this._register(( (new RunOnceScheduler(() => this.doFlushWhenIdle(), this.options.flushInterval)))); | ||
this.runFlushWhenIdle = this._register(( (new MutableDisposable()))); | ||
this._workspaceKeyTargets = undefined; | ||
this._profileKeyTargets = undefined; | ||
this._applicationKeyTargets = undefined; | ||
} | ||
doFlushWhenIdle() { | ||
this.runFlushWhenIdle.value = runWhenIdle(() => { | ||
if (this.shouldFlushWhenIdle()) { | ||
this.flush(); | ||
} | ||
this.flushWhenIdleScheduler.schedule(); | ||
}); | ||
} | ||
shouldFlushWhenIdle() { | ||
return true; | ||
} | ||
stopFlushWhenIdle() { | ||
dispose([this.runFlushWhenIdle, this.flushWhenIdleScheduler]); | ||
} | ||
initialize() { | ||
if (!this.initializationPromise) { | ||
this.initializationPromise = (async () => { | ||
try { | ||
await this.doInitialize(); | ||
} | ||
finally { | ||
} | ||
this.flushWhenIdleScheduler.schedule(); | ||
})(); | ||
} | ||
return this.initializationPromise; | ||
} | ||
emitDidChangeValue(scope, key) { | ||
if (key === TARGET_KEY) { | ||
switch (scope) { | ||
case -1 : | ||
this._applicationKeyTargets = undefined; | ||
break; | ||
case 0 : | ||
this._profileKeyTargets = undefined; | ||
break; | ||
case 1 : | ||
this._workspaceKeyTargets = undefined; | ||
break; | ||
} | ||
this._onDidChangeTarget.fire({ scope }); | ||
} | ||
else { | ||
this._onDidChangeValue.fire({ scope, key, target: this.getKeyTargets(scope)[key] }); | ||
} | ||
} | ||
emitWillSaveState(reason) { | ||
this._onWillSaveState.fire({ reason }); | ||
} | ||
get(key, scope, fallbackValue) { | ||
return this.getStorage(scope)?.get(key, fallbackValue); | ||
} | ||
getBoolean(key, scope, fallbackValue) { | ||
return this.getStorage(scope)?.getBoolean(key, fallbackValue); | ||
} | ||
getNumber(key, scope, fallbackValue) { | ||
return this.getStorage(scope)?.getNumber(key, fallbackValue); | ||
} | ||
store(key, value, scope, target) { | ||
if (isUndefinedOrNull(value)) { | ||
this.remove(key, scope); | ||
return; | ||
} | ||
this.withPausedEmitters(() => { | ||
this.updateKeyTarget(key, scope, target); | ||
this.getStorage(scope)?.set(key, value); | ||
}); | ||
} | ||
remove(key, scope) { | ||
this.withPausedEmitters(() => { | ||
this.updateKeyTarget(key, scope, undefined); | ||
this.getStorage(scope)?.delete(key); | ||
}); | ||
} | ||
withPausedEmitters(fn) { | ||
this._onDidChangeValue.pause(); | ||
this._onDidChangeTarget.pause(); | ||
try { | ||
fn(); | ||
} | ||
finally { | ||
this._onDidChangeValue.resume(); | ||
this._onDidChangeTarget.resume(); | ||
} | ||
} | ||
keys(scope, target) { | ||
const keys = []; | ||
const keyTargets = this.getKeyTargets(scope); | ||
for (const key of ( (Object.keys(keyTargets)))) { | ||
const keyTarget = keyTargets[key]; | ||
if (keyTarget === target) { | ||
keys.push(key); | ||
} | ||
} | ||
return keys; | ||
} | ||
updateKeyTarget(key, scope, target) { | ||
const keyTargets = this.getKeyTargets(scope); | ||
if (typeof target === 'number') { | ||
if (keyTargets[key] !== target) { | ||
keyTargets[key] = target; | ||
this.getStorage(scope)?.set(TARGET_KEY, JSON.stringify(keyTargets)); | ||
} | ||
} | ||
else { | ||
if (typeof keyTargets[key] === 'number') { | ||
delete keyTargets[key]; | ||
this.getStorage(scope)?.set(TARGET_KEY, JSON.stringify(keyTargets)); | ||
} | ||
} | ||
} | ||
get workspaceKeyTargets() { | ||
if (!this._workspaceKeyTargets) { | ||
this._workspaceKeyTargets = this.loadKeyTargets(1 ); | ||
} | ||
return this._workspaceKeyTargets; | ||
} | ||
get profileKeyTargets() { | ||
if (!this._profileKeyTargets) { | ||
this._profileKeyTargets = this.loadKeyTargets(0 ); | ||
} | ||
return this._profileKeyTargets; | ||
} | ||
get applicationKeyTargets() { | ||
if (!this._applicationKeyTargets) { | ||
this._applicationKeyTargets = this.loadKeyTargets(-1 ); | ||
} | ||
return this._applicationKeyTargets; | ||
} | ||
getKeyTargets(scope) { | ||
switch (scope) { | ||
case -1 : | ||
return this.applicationKeyTargets; | ||
case 0 : | ||
return this.profileKeyTargets; | ||
default: | ||
return this.workspaceKeyTargets; | ||
} | ||
} | ||
loadKeyTargets(scope) { | ||
const keysRaw = this.get(TARGET_KEY, scope); | ||
if (keysRaw) { | ||
try { | ||
return JSON.parse(keysRaw); | ||
} | ||
catch (error) { | ||
} | ||
} | ||
return Object.create(null); | ||
} | ||
isNew(scope) { | ||
return this.getBoolean(IS_NEW_KEY, scope) === true; | ||
} | ||
async flush(reason = WillSaveStateReason.NONE) { | ||
this._onWillSaveState.fire({ reason }); | ||
const applicationStorage = this.getStorage(-1 ); | ||
const profileStorage = this.getStorage(0 ); | ||
const workspaceStorage = this.getStorage(1 ); | ||
switch (reason) { | ||
case WillSaveStateReason.NONE: | ||
await Promises.settled([ | ||
applicationStorage?.whenFlushed() ?? Promise.resolve(), | ||
profileStorage?.whenFlushed() ?? Promise.resolve(), | ||
workspaceStorage?.whenFlushed() ?? Promise.resolve() | ||
]); | ||
break; | ||
case WillSaveStateReason.SHUTDOWN: | ||
await Promises.settled([ | ||
applicationStorage?.flush(0) ?? Promise.resolve(), | ||
profileStorage?.flush(0) ?? Promise.resolve(), | ||
workspaceStorage?.flush(0) ?? Promise.resolve() | ||
]); | ||
break; | ||
} | ||
} | ||
async log() { | ||
const applicationItems = this.getStorage(-1 )?.items ?? ( (new Map())); | ||
const profileItems = this.getStorage(0 )?.items ?? ( (new Map())); | ||
const workspaceItems = this.getStorage(1 )?.items ?? ( (new Map())); | ||
return logStorage(applicationItems, profileItems, workspaceItems, this.getLogDetails(-1 ) ?? '', this.getLogDetails(0 ) ?? '', this.getLogDetails(1 ) ?? ''); | ||
} | ||
async switch(to, preserveData) { | ||
this.emitWillSaveState(WillSaveStateReason.NONE); | ||
if (isUserDataProfile(to)) { | ||
return this.switchToProfile(to, preserveData); | ||
} | ||
return this.switchToWorkspace(to, preserveData); | ||
} | ||
canSwitchProfile(from, to) { | ||
if (from.id === to.id) { | ||
return false; | ||
} | ||
if (isProfileUsingDefaultStorage(to) && isProfileUsingDefaultStorage(from)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
switchData(oldStorage, newStorage, scope, preserveData) { | ||
this.withPausedEmitters(() => { | ||
if (preserveData) { | ||
for (const [key, value] of oldStorage) { | ||
newStorage.set(key, value); | ||
} | ||
} | ||
else { | ||
const handledkeys = ( (new Set())); | ||
for (const [key, oldValue] of oldStorage) { | ||
handledkeys.add(key); | ||
const newValue = newStorage.get(key); | ||
if (newValue !== oldValue) { | ||
this.emitDidChangeValue(scope, key); | ||
} | ||
} | ||
for (const [key] of newStorage.items) { | ||
if (!handledkeys.has(key)) { | ||
this.emitDidChangeValue(scope, key); | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
AbstractStorageService.DEFAULT_FLUSH_INTERVAL = 60 * 1000; | ||
function isProfileUsingDefaultStorage(profile) { | ||
return profile.isDefault || !!profile.useDefaultFlags?.uiState; | ||
} | ||
async function logStorage(application, profile, workspace, applicationPath, profilePath, workspacePath) { | ||
const safeParse = (value) => { | ||
try { | ||
return JSON.parse(value); | ||
} | ||
catch (error) { | ||
return value; | ||
} | ||
}; | ||
const applicationItems = ( (new Map())); | ||
const applicationItemsParsed = ( (new Map())); | ||
application.forEach((value, key) => { | ||
applicationItems.set(key, value); | ||
applicationItemsParsed.set(key, safeParse(value)); | ||
}); | ||
const profileItems = ( (new Map())); | ||
const profileItemsParsed = ( (new Map())); | ||
profile.forEach((value, key) => { | ||
profileItems.set(key, value); | ||
profileItemsParsed.set(key, safeParse(value)); | ||
}); | ||
const workspaceItems = ( (new Map())); | ||
const workspaceItemsParsed = ( (new Map())); | ||
workspace.forEach((value, key) => { | ||
workspaceItems.set(key, value); | ||
workspaceItemsParsed.set(key, safeParse(value)); | ||
}); | ||
if (applicationPath !== profilePath) { | ||
console.group(`Storage: Application (path: ${applicationPath})`); | ||
} | ||
else { | ||
console.group(`Storage: Application & Profile (path: ${applicationPath}, default profile)`); | ||
} | ||
const applicationValues = []; | ||
applicationItems.forEach((value, key) => { | ||
applicationValues.push({ key, value }); | ||
}); | ||
console.table(applicationValues); | ||
console.groupEnd(); | ||
console.log(applicationItemsParsed); | ||
if (applicationPath !== profilePath) { | ||
console.group(`Storage: Profile (path: ${profilePath}, profile specific)`); | ||
const profileValues = []; | ||
profileItems.forEach((value, key) => { | ||
profileValues.push({ key, value }); | ||
}); | ||
console.table(profileValues); | ||
console.groupEnd(); | ||
console.log(profileItemsParsed); | ||
} | ||
console.group(`Storage: Workspace (path: ${workspacePath})`); | ||
const workspaceValues = []; | ||
workspaceItems.forEach((value, key) => { | ||
workspaceValues.push({ key, value }); | ||
}); | ||
console.table(workspaceValues); | ||
console.groupEnd(); | ||
console.log(workspaceItemsParsed); | ||
} | ||
const IEditorGroupsService = ( (createDecorator('editorGroupsService'))); | ||
@@ -298,2 +872,2 @@ function isEditorGroup(obj) { | ||
})(Services || (Services = {}))); | ||
export { ACTIVE_GROUP as A, ensureFileSystemProviderError as B, CancellationTokenSource as C, etag as D, FileOperationEvent as E, FileType as F, toFileOperationResult as G, ETAG_DISABLED as H, IEditorService as I, hasFileAtomicReadCapability as J, hasFileFolderCopyCapability as K, hasFileCloneCapability as L, createFileSystemProviderError as M, NotModifiedSinceFileOperationError as N, FILES_ASSOCIATIONS_CONFIG as O, Services as S, FilePermission as a, IEditorGroupsService as b, IProductService as c, FileSystemProviderErrorCode as d, SIDE_GROUP as e, IUriIdentityService as f, IPaneCompositePartService as g, ITextFileService as h, IFileService as i, IWorkbenchEnvironmentService as j, IWorkingCopyFileService as k, IPathService as l, markAsFileSystemProviderError as m, ILanguageStatusService as n, IHostService as o, productSchemaId as p, ISnippetsService as q, refineServiceDecorator as r, isPreferredGroup as s, FileSystemProviderError as t, FileChangesEvent as u, FileOperationError as v, hasOpenReadWriteCloseCapability as w, hasReadWriteCapability as x, hasFileReadStreamCapability as y, toFileSystemProviderErrorCode as z }; | ||
export { ACTIVE_GROUP as A, hasReadWriteCapability as B, CancellationTokenSource as C, hasFileReadStreamCapability as D, toFileSystemProviderErrorCode as E, FileType as F, ensureFileSystemProviderError as G, etag as H, IEditorService as I, FileOperationEvent as J, toFileOperationResult as K, ETAG_DISABLED as L, hasFileAtomicReadCapability as M, NotModifiedSinceFileOperationError as N, hasFileFolderCopyCapability as O, PROFILES_ENABLEMENT_CONFIG as P, hasFileCloneCapability as Q, createFileSystemProviderError as R, Services as S, FILES_ASSOCIATIONS_CONFIG as T, FilePermission as a, IEditorGroupsService as b, IProductService as c, FileSystemProviderErrorCode as d, SIDE_GROUP as e, IUriIdentityService as f, IPaneCompositePartService as g, ITextFileService as h, IFileService as i, IWorkbenchEnvironmentService as j, IWorkingCopyFileService as k, IPathService as l, markAsFileSystemProviderError as m, ILanguageStatusService as n, IHostService as o, productSchemaId as p, IUserDataProfilesService as q, ISnippetsService as r, refineServiceDecorator as s, StorageScope as t, StorageTarget as u, isPreferredGroup as v, FileSystemProviderError as w, FileChangesEvent as x, FileOperationError as y, hasOpenReadWriteCloseCapability as z }; |
@@ -1,5 +0,5 @@ | ||
import { k as parse, m as getNodeType } from './polyfill.js'; | ||
import { j as ExtensionMessageCollector, l as IUserDataProfileService, b as ILifecycleService, E as ExtensionsRegistry } from './missing-services.js'; | ||
import { q as ISnippetsService, S as Services, i as IFileService, h as ITextFileService } from './services2.js'; | ||
import { _ as __decorate, a as __param } from './contextkey.js'; | ||
import { j as parse, k as getNodeType } from './polyfill.js'; | ||
import { h as ExtensionMessageCollector, k as IUserDataProfileService, b as ILifecycleService, E as ExtensionsRegistry } from './missing-services.js'; | ||
import { r as ISnippetsService, S as Services, i as IFileService, h as ITextFileService } from './services2.js'; | ||
import { _ as __decorate, a as __param } from './workspace.js'; | ||
import * as monacoSuggest from 'monaco-editor/esm/vs/editor/contrib/suggest/browser/suggest.js'; | ||
@@ -6,0 +6,0 @@ import { extname as extname$1, basename as basename$1 } from 'monaco-editor/esm/vs/base/common/path.js'; |
@@ -1,5 +0,5 @@ | ||
import { _ as __decorate, a as __param } from './contextkey.js'; | ||
import { E as Emitter } from './polyfill.js'; | ||
import { j as ExtensionMessageCollector, n as ITextMateService, E as ExtensionsRegistry } from './missing-services.js'; | ||
export { n as ITextMateService } from './missing-services.js'; | ||
import { _ as __decorate, a as __param, E as Emitter } from './workspace.js'; | ||
import './polyfill.js'; | ||
import { h as ExtensionMessageCollector, m as ITextMateService, E as ExtensionsRegistry } from './missing-services.js'; | ||
export { m as ITextMateService } from './missing-services.js'; | ||
import { l as languagesExtPoint } from './languageService.js'; | ||
@@ -6,0 +6,0 @@ import { localize } from 'monaco-editor/esm/vs/nls.js'; |
import './polyfill.js'; | ||
import { j as ExtensionMessageCollector, E as ExtensionsRegistry } from './missing-services.js'; | ||
import { h as ExtensionMessageCollector, E as ExtensionsRegistry } from './missing-services.js'; | ||
import { g as getTokenClassificationRegistry, a as typeAndModifierIdPattern } from './tokenClassificationRegistry.js'; | ||
@@ -4,0 +4,0 @@ import { localize } from 'monaco-editor/esm/vs/nls.js'; |
@@ -1,2 +0,2 @@ | ||
import { E as Emitter } from './polyfill.js'; | ||
import { E as Emitter } from './workspace.js'; | ||
import { localize } from 'monaco-editor/esm/vs/nls.js'; | ||
@@ -3,0 +3,0 @@ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js'; |
@@ -1,2 +0,2 @@ | ||
import { r as refineServiceDecorator } from './services2.js'; | ||
import { s as refineServiceDecorator } from './services2.js'; | ||
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js'; | ||
@@ -3,0 +3,0 @@ import { isString, isBoolean } from 'monaco-editor/esm/vs/base/common/types.js'; |
{ | ||
"name": "@codingame/monaco-vscode-api", | ||
"version": "1.69.10", | ||
"version": "1.69.11", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "VSCode public API plugged on the monaco editor", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
2634511
65784