mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-06 17:23:53 -05:00
Merge from vscode 718331d6f3ebd1b571530ab499edb266ddd493d5
This commit is contained in:
@@ -158,7 +158,7 @@ CommandsRegistry.registerCommand(OpenWithAPICommand.ID, adjustHandler(OpenWithAP
|
||||
|
||||
CommandsRegistry.registerCommand('_workbench.removeFromRecentlyOpened', function (accessor: ServicesAccessor, uri: URI) {
|
||||
const workspacesService = accessor.get(IWorkspacesService);
|
||||
return workspacesService.removeFromRecentlyOpened([uri]);
|
||||
return workspacesService.removeRecentlyOpened([uri]);
|
||||
});
|
||||
|
||||
export class RemoveFromRecentlyOpenedAPICommand {
|
||||
|
||||
@@ -317,6 +317,5 @@ jsonRegistry.registerSchema('vscode://schemas/workspaceConfig', {
|
||||
description: nls.localize('workspaceConfig.remoteAuthority', "The remote server where the workspace is located. Only used by unsaved remote workspaces."),
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
errorMessage: nls.localize('unknownWorkspaceProperty', "Unknown workspace configuration property")
|
||||
});
|
||||
|
||||
@@ -72,6 +72,7 @@ import { ExtHostTheming } from 'vs/workbench/api/common/extHostTheming';
|
||||
import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService';
|
||||
import { IExtHostApiDeprecationService } from 'vs/workbench/api/common/extHostApiDeprecationService';
|
||||
import { ExtHostAuthentication } from 'vs/workbench/api/common/extHostAuthentication';
|
||||
import { ExtHostTimeline } from 'vs/workbench/api/common/extHostTimeline';
|
||||
|
||||
export interface IExtensionApiFactory {
|
||||
(extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode;
|
||||
@@ -133,6 +134,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
const extHostLabelService = rpcProtocol.set(ExtHostContext.ExtHostLabelService, new ExtHostLabelService(rpcProtocol));
|
||||
const extHostTheming = rpcProtocol.set(ExtHostContext.ExtHostTheming, new ExtHostTheming(rpcProtocol));
|
||||
const extHostAuthentication = rpcProtocol.set(ExtHostContext.ExtHostAuthentication, new ExtHostAuthentication(rpcProtocol));
|
||||
const extHostTimeline = rpcProtocol.set(ExtHostContext.ExtHostTimeline, new ExtHostTimeline(rpcProtocol));
|
||||
|
||||
// Check that no named customers are missing
|
||||
// {{SQL CARBON EDIT}} filter out the services we don't expose
|
||||
@@ -189,11 +191,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
get providers() {
|
||||
return extHostAuthentication.providers(extension);
|
||||
},
|
||||
get onDidRegisterAuthenticationProvider() {
|
||||
return extHostAuthentication.onDidRegisterAuthenticationProvider;
|
||||
},
|
||||
get onDidUnregisterAuthenticationProvider() {
|
||||
return extHostAuthentication.onDidUnregisterAuthenticationProvider;
|
||||
get onDidChangeAuthenticationProviders(): Event<vscode.AuthenticationProvidersChangeEvent> {
|
||||
return extHostAuthentication.onDidChangeAuthenticationProviders;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -761,9 +760,19 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostTunnelService.getTunnels();
|
||||
},
|
||||
onDidChangeTunnels: (listener, thisArg?, disposables?) => {
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostTunnelService.onDidChangeTunnels(listener, thisArg, disposables);
|
||||
|
||||
},
|
||||
onDidTunnelsChange: (listener, thisArg?, disposables?) => {
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostTunnelService.onDidTunnelsChange(listener, thisArg, disposables);
|
||||
return extHostTunnelService.onDidChangeTunnels(listener, thisArg, disposables);
|
||||
|
||||
},
|
||||
registerTimelineProvider: (scheme: string, provider: vscode.TimelineProvider) => {
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostTimeline.registerTimelineProvider(provider, extension.identifier, extHostCommands.converter);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -986,7 +995,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
Decoration: extHostTypes.Decoration,
|
||||
WebviewContentState: extHostTypes.WebviewContentState,
|
||||
UIKind: UIKind,
|
||||
ColorThemeKind: extHostTypes.ColorThemeKind
|
||||
ColorThemeKind: extHostTypes.ColorThemeKind,
|
||||
TimelineItem: extHostTypes.TimelineItem
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ import { SaveReason } from 'vs/workbench/common/editor';
|
||||
import { ExtensionActivationReason } from 'vs/workbench/api/common/extHostExtensionActivator';
|
||||
import { TunnelDto } from 'vs/workbench/api/common/extHostTunnelService';
|
||||
import { TunnelOptions } from 'vs/platform/remote/common/tunnel';
|
||||
import { TimelineItem, TimelineProviderDescriptor, TimelineChangeEvent, TimelineItemWithSource } from 'vs/workbench/contrib/timeline/common/timeline';
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { ITreeItem as sqlITreeItem } from 'sql/workbench/common/views';
|
||||
@@ -714,7 +715,7 @@ export interface SCMGroupFeatures {
|
||||
export type SCMRawResource = [
|
||||
number /*handle*/,
|
||||
UriComponents /*resourceUri*/,
|
||||
string[] /*icons: light, dark*/,
|
||||
UriComponents[] /*icons: light, dark*/,
|
||||
string /*tooltip*/,
|
||||
boolean /*strike through*/,
|
||||
boolean /*faded*/
|
||||
@@ -801,6 +802,14 @@ export interface MainThreadTunnelServiceShape extends IDisposable {
|
||||
$setCandidateFilter(): Promise<void>;
|
||||
}
|
||||
|
||||
export interface MainThreadTimelineShape extends IDisposable {
|
||||
$registerTimelineProvider(provider: TimelineProviderDescriptor): void;
|
||||
$unregisterTimelineProvider(source: string): void;
|
||||
$emitTimelineChangeEvent(e: TimelineChangeEvent): void;
|
||||
|
||||
$getTimeline(uri: UriComponents, token: CancellationToken): Promise<TimelineItem[]>;
|
||||
}
|
||||
|
||||
// -- extension host
|
||||
|
||||
export interface ExtHostCommandsShape {
|
||||
@@ -914,8 +923,9 @@ export interface ExtHostLabelServiceShape {
|
||||
}
|
||||
|
||||
export interface ExtHostAuthenticationShape {
|
||||
$getSessions(id: string): Promise<ReadonlyArray<modes.Session>>;
|
||||
$login(id: string, scopes: string[]): Promise<modes.Session>;
|
||||
$getSessions(id: string): Promise<ReadonlyArray<modes.AuthenticationSession>>;
|
||||
$getSessionAccessToken(id: string, sessionId: string): Promise<string>;
|
||||
$login(id: string, scopes: string[]): Promise<modes.AuthenticationSession>;
|
||||
$logout(id: string, sessionId: string): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -1445,6 +1455,10 @@ export interface ExtHostTunnelServiceShape {
|
||||
$onDidTunnelsChange(): Promise<void>;
|
||||
}
|
||||
|
||||
export interface ExtHostTimelineShape {
|
||||
$getTimeline(source: string, uri: UriComponents, token: CancellationToken): Promise<TimelineItemWithSource[]>;
|
||||
}
|
||||
|
||||
// --- proxy identifiers
|
||||
|
||||
export const MainContext = {
|
||||
@@ -1488,7 +1502,8 @@ export const MainContext = {
|
||||
MainThreadWindow: createMainId<MainThreadWindowShape>('MainThreadWindow'),
|
||||
MainThreadLabelService: createMainId<MainThreadLabelServiceShape>('MainThreadLabelService'),
|
||||
MainThreadTheming: createMainId<MainThreadThemingShape>('MainThreadTheming'),
|
||||
MainThreadTunnelService: createMainId<MainThreadTunnelServiceShape>('MainThreadTunnelService')
|
||||
MainThreadTunnelService: createMainId<MainThreadTunnelServiceShape>('MainThreadTunnelService'),
|
||||
MainThreadTimeline: createMainId<MainThreadTimelineShape>('MainThreadTimeline')
|
||||
};
|
||||
|
||||
export const ExtHostContext = {
|
||||
@@ -1525,5 +1540,6 @@ export const ExtHostContext = {
|
||||
ExtHostLabelService: createMainId<ExtHostLabelServiceShape>('ExtHostLabelService'),
|
||||
ExtHostTheming: createMainId<ExtHostThemingShape>('ExtHostTheming'),
|
||||
ExtHostTunnelService: createMainId<ExtHostTunnelServiceShape>('ExtHostTunnelService'),
|
||||
ExtHostAuthentication: createMainId<ExtHostAuthenticationShape>('ExtHostAuthentication')
|
||||
ExtHostAuthentication: createMainId<ExtHostAuthenticationShape>('ExtHostAuthentication'),
|
||||
ExtHostTimeline: createMainId<ExtHostTimelineShape>('ExtHostTimeline')
|
||||
};
|
||||
|
||||
@@ -142,7 +142,7 @@ const newCommands: ApiCommand[] = [
|
||||
),
|
||||
// -- go to symbol (definition, type definition, declaration, impl, references)
|
||||
new ApiCommand(
|
||||
'vscode.executeDefinitionProvider', '_executeDefinitionProvider', 'Execute all definition provider.',
|
||||
'vscode.executeDefinitionProvider', '_executeDefinitionProvider', 'Execute all definition providers.',
|
||||
[ApiCommandArgument.Uri, ApiCommandArgument.Position],
|
||||
new ApiCommandResult<modes.Location[], types.Location[] | undefined>('A promise that resolves to an array of Location-instances.', tryMapWith(typeConverters.location.to))
|
||||
),
|
||||
@@ -168,7 +168,7 @@ const newCommands: ApiCommand[] = [
|
||||
),
|
||||
// -- hover
|
||||
new ApiCommand(
|
||||
'vscode.executeHoverProvider', '_executeHoverProvider', 'Execute all hover provider.',
|
||||
'vscode.executeHoverProvider', '_executeHoverProvider', 'Execute all hover providers.',
|
||||
[ApiCommandArgument.Uri, ApiCommandArgument.Position],
|
||||
new ApiCommandResult<modes.Hover[], types.Hover[] | undefined>('A promise that resolves to an array of Hover-instances.', tryMapWith(typeConverters.Hover.to))
|
||||
),
|
||||
@@ -188,7 +188,7 @@ const newCommands: ApiCommand[] = [
|
||||
),
|
||||
// -- symbol search
|
||||
new ApiCommand(
|
||||
'vscode.executeWorkspaceSymbolProvider', '_executeWorkspaceSymbolProvider', 'Execute all workspace symbol provider.',
|
||||
'vscode.executeWorkspaceSymbolProvider', '_executeWorkspaceSymbolProvider', 'Execute all workspace symbol providers.',
|
||||
[new ApiCommandArgument('query', 'Search string', v => typeof v === 'string', v => v)],
|
||||
new ApiCommandResult<[search.IWorkspaceSymbolProvider, search.IWorkspaceSymbol[]][], types.SymbolInformation[]>('A promise that resolves to an array of SymbolInformation-instances.', value => {
|
||||
const result: types.SymbolInformation[] = [];
|
||||
|
||||
@@ -28,16 +28,30 @@ export class AuthenticationProviderWrapper implements vscode.AuthenticationProvi
|
||||
return this._provider.displayName;
|
||||
}
|
||||
|
||||
async getSessions(): Promise<ReadonlyArray<vscode.Session>> {
|
||||
const isAllowed = await this._proxy.$getSessionsPrompt(this._provider.id, this.displayName, ExtensionIdentifier.toKey(this._requestingExtension.identifier), this._requestingExtension.displayName || this._requestingExtension.name);
|
||||
if (!isAllowed) {
|
||||
throw new Error('User did not consent to session access.');
|
||||
}
|
||||
async getSessions(): Promise<ReadonlyArray<vscode.AuthenticationSession>> {
|
||||
return (await this._provider.getSessions()).map(session => {
|
||||
return {
|
||||
id: session.id,
|
||||
accountName: session.accountName,
|
||||
scopes: session.scopes,
|
||||
accessToken: async () => {
|
||||
const isAllowed = await this._proxy.$getSessionsPrompt(
|
||||
this._provider.id,
|
||||
this.displayName,
|
||||
ExtensionIdentifier.toKey(this._requestingExtension.identifier),
|
||||
this._requestingExtension.displayName || this._requestingExtension.name);
|
||||
|
||||
return this._provider.getSessions();
|
||||
if (!isAllowed) {
|
||||
throw new Error('User did not consent to token access.');
|
||||
}
|
||||
|
||||
return session.accessToken();
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async login(scopes: string[]): Promise<vscode.Session> {
|
||||
async login(scopes: string[]): Promise<vscode.AuthenticationSession> {
|
||||
const isAllowed = await this._proxy.$loginPrompt(this._provider.id, this.displayName, ExtensionIdentifier.toKey(this._requestingExtension.identifier), this._requestingExtension.displayName || this._requestingExtension.name);
|
||||
if (!isAllowed) {
|
||||
throw new Error('User did not consent to login.');
|
||||
@@ -55,11 +69,8 @@ export class ExtHostAuthentication implements ExtHostAuthenticationShape {
|
||||
private _proxy: MainThreadAuthenticationShape;
|
||||
private _authenticationProviders: Map<string, vscode.AuthenticationProvider> = new Map<string, vscode.AuthenticationProvider>();
|
||||
|
||||
private _onDidRegisterAuthenticationProvider = new Emitter<string>();
|
||||
readonly onDidRegisterAuthenticationProvider: Event<string> = this._onDidRegisterAuthenticationProvider.event;
|
||||
|
||||
private _onDidUnregisterAuthenticationProvider = new Emitter<string>();
|
||||
readonly onDidUnregisterAuthenticationProvider: Event<string> = this._onDidUnregisterAuthenticationProvider.event;
|
||||
private _onDidChangeAuthenticationProviders = new Emitter<vscode.AuthenticationProvidersChangeEvent>();
|
||||
readonly onDidChangeAuthenticationProviders: Event<vscode.AuthenticationProvidersChangeEvent> = this._onDidChangeAuthenticationProviders.event;
|
||||
|
||||
constructor(mainContext: IMainContext) {
|
||||
this._proxy = mainContext.getProxy(MainContext.MainThreadAuthentication);
|
||||
@@ -83,23 +94,23 @@ export class ExtHostAuthentication implements ExtHostAuthenticationShape {
|
||||
});
|
||||
|
||||
this._proxy.$registerAuthenticationProvider(provider.id, provider.displayName);
|
||||
this._onDidRegisterAuthenticationProvider.fire(provider.id);
|
||||
this._onDidChangeAuthenticationProviders.fire({ added: [provider.id], removed: [] });
|
||||
|
||||
return new Disposable(() => {
|
||||
listener.dispose();
|
||||
this._authenticationProviders.delete(provider.id);
|
||||
this._proxy.$unregisterAuthenticationProvider(provider.id);
|
||||
this._onDidUnregisterAuthenticationProvider.fire(provider.id);
|
||||
this._onDidChangeAuthenticationProviders.fire({ added: [], removed: [provider.id] });
|
||||
});
|
||||
}
|
||||
|
||||
$login(providerId: string, scopes: string[]): Promise<modes.Session> {
|
||||
$login(providerId: string, scopes: string[]): Promise<modes.AuthenticationSession> {
|
||||
const authProvider = this._authenticationProviders.get(providerId);
|
||||
if (authProvider) {
|
||||
return Promise.resolve(authProvider.login(scopes));
|
||||
}
|
||||
|
||||
throw new Error(`Unable to find authentication provider with handle: ${0}`);
|
||||
throw new Error(`Unable to find authentication provider with handle: ${providerId}`);
|
||||
}
|
||||
|
||||
$logout(providerId: string, sessionId: string): Promise<void> {
|
||||
@@ -108,15 +119,30 @@ export class ExtHostAuthentication implements ExtHostAuthenticationShape {
|
||||
return Promise.resolve(authProvider.logout(sessionId));
|
||||
}
|
||||
|
||||
throw new Error(`Unable to find authentication provider with handle: ${0}`);
|
||||
throw new Error(`Unable to find authentication provider with handle: ${providerId}`);
|
||||
}
|
||||
|
||||
$getSessions(providerId: string): Promise<ReadonlyArray<modes.Session>> {
|
||||
$getSessions(providerId: string): Promise<ReadonlyArray<modes.AuthenticationSession>> {
|
||||
const authProvider = this._authenticationProviders.get(providerId);
|
||||
if (authProvider) {
|
||||
return Promise.resolve(authProvider.getSessions());
|
||||
}
|
||||
|
||||
throw new Error(`Unable to find authentication provider with handle: ${0}`);
|
||||
throw new Error(`Unable to find authentication provider with handle: ${providerId}`);
|
||||
}
|
||||
|
||||
async $getSessionAccessToken(providerId: string, sessionId: string): Promise<string> {
|
||||
const authProvider = this._authenticationProviders.get(providerId);
|
||||
if (authProvider) {
|
||||
const sessions = await authProvider.getSessions();
|
||||
const session = sessions.find(session => session.id === sessionId);
|
||||
if (session) {
|
||||
return session.accessToken();
|
||||
}
|
||||
|
||||
throw new Error(`Unable to find session with id: ${sessionId}`);
|
||||
}
|
||||
|
||||
throw new Error(`Unable to find authentication provider with handle: ${providerId}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { Workspace } from 'vs/platform/workspace/common/workspace';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
|
||||
|
||||
function lookUp(tree: any, key: string) {
|
||||
if (key) {
|
||||
@@ -42,7 +41,7 @@ type ConfigurationInspect<T> = {
|
||||
workspaceFolderValue?: T,
|
||||
|
||||
defaultLanguageValue?: T;
|
||||
userLanguageValue?: T;
|
||||
globalLanguageValue?: T;
|
||||
workspaceLanguageValue?: T;
|
||||
workspaceFolderLanguageValue?: T;
|
||||
|
||||
@@ -157,9 +156,6 @@ export class ExtHostConfigProvider {
|
||||
|
||||
getConfiguration(section?: string, scope?: vscode.ConfigurationScope | null, extensionDescription?: IExtensionDescription): vscode.WorkspaceConfiguration {
|
||||
const overrides = scopeToOverrides(scope) || {};
|
||||
if (overrides.overrideIdentifier && extensionDescription) {
|
||||
checkProposedApiEnabled(extensionDescription);
|
||||
}
|
||||
const config = this._toReadonlyValue(section
|
||||
? lookUp(this._configuration.getValue(undefined, overrides, this._extHostWorkspace.workspace), section)
|
||||
: this._configuration.getValue(undefined, overrides, this._extHostWorkspace.workspace));
|
||||
@@ -260,13 +256,13 @@ export class ExtHostConfigProvider {
|
||||
return {
|
||||
key,
|
||||
|
||||
defaultValue: config.defaultValue,
|
||||
globalValue: config.userValue,
|
||||
workspaceValue: config.workspaceValue,
|
||||
workspaceFolderValue: config.workspaceFolderValue,
|
||||
defaultValue: config.default?.value,
|
||||
globalValue: config.user?.value,
|
||||
workspaceValue: config.workspace?.value,
|
||||
workspaceFolderValue: config.workspaceFolder?.value,
|
||||
|
||||
defaultLanguageValue: config.default?.override,
|
||||
userLanguageValue: config.user?.override,
|
||||
globalLanguageValue: config.user?.override,
|
||||
workspaceLanguageValue: config.workspace?.override,
|
||||
workspaceFolderLanguageValue: config.workspaceFolder?.override,
|
||||
|
||||
|
||||
@@ -369,7 +369,8 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
|
||||
get extensionPath() { return extensionDescription.extensionLocation.fsPath; },
|
||||
get storagePath() { return that._storagePath.workspaceValue(extensionDescription); },
|
||||
get globalStoragePath() { return that._storagePath.globalValue(extensionDescription); },
|
||||
asAbsolutePath: (relativePath: string) => { return path.join(extensionDescription.extensionLocation.fsPath, relativePath); },
|
||||
asAbsolutePath(relativePath: string) { return path.join(extensionDescription.extensionLocation.fsPath, relativePath); },
|
||||
asExtensionUri(relativePath: string) { return joinPath(extensionDescription.extensionLocation, relativePath); },
|
||||
get logPath() { return path.join(that._initData.logsLocation.fsPath, extensionDescription.identifier.value); }
|
||||
});
|
||||
});
|
||||
|
||||
@@ -22,15 +22,14 @@ type ProviderHandle = number;
|
||||
type GroupHandle = number;
|
||||
type ResourceStateHandle = number;
|
||||
|
||||
function getIconPath(decorations?: vscode.SourceControlResourceThemableDecorations): string | undefined {
|
||||
function getIconResource(decorations?: vscode.SourceControlResourceThemableDecorations): vscode.Uri | undefined {
|
||||
if (!decorations) {
|
||||
return undefined;
|
||||
} else if (typeof decorations.iconPath === 'string') {
|
||||
return URI.file(decorations.iconPath).toString();
|
||||
} else if (decorations.iconPath) {
|
||||
return `${decorations.iconPath}`;
|
||||
return URI.file(decorations.iconPath);
|
||||
} else {
|
||||
return decorations.iconPath;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function compareResourceThemableDecorations(a: vscode.SourceControlResourceThemableDecorations, b: vscode.SourceControlResourceThemableDecorations): number {
|
||||
@@ -287,28 +286,28 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
|
||||
this._resourceStatesMap.set(handle, r);
|
||||
|
||||
const sourceUri = r.resourceUri;
|
||||
const iconPath = getIconPath(r.decorations);
|
||||
const lightIconPath = r.decorations && getIconPath(r.decorations.light) || iconPath;
|
||||
const darkIconPath = r.decorations && getIconPath(r.decorations.dark) || iconPath;
|
||||
const icons: string[] = [];
|
||||
const iconUri = getIconResource(r.decorations);
|
||||
const lightIconUri = r.decorations && getIconResource(r.decorations.light) || iconUri;
|
||||
const darkIconUri = r.decorations && getIconResource(r.decorations.dark) || iconUri;
|
||||
const icons: UriComponents[] = [];
|
||||
|
||||
if (r.command) {
|
||||
this._resourceStatesCommandsMap.set(handle, r.command);
|
||||
}
|
||||
|
||||
if (lightIconPath) {
|
||||
icons.push(lightIconPath);
|
||||
if (lightIconUri) {
|
||||
icons.push(lightIconUri);
|
||||
}
|
||||
|
||||
if (darkIconPath && (darkIconPath !== lightIconPath)) {
|
||||
icons.push(darkIconPath);
|
||||
if (darkIconUri && (darkIconUri.toString() !== lightIconUri?.toString())) {
|
||||
icons.push(darkIconUri);
|
||||
}
|
||||
|
||||
const tooltip = (r.decorations && r.decorations.tooltip) || '';
|
||||
const strikeThrough = r.decorations && !!r.decorations.strikeThrough;
|
||||
const faded = r.decorations && !!r.decorations.faded;
|
||||
|
||||
const rawResource = [handle, <UriComponents>sourceUri, icons, tooltip, strikeThrough, faded] as SCMRawResource;
|
||||
const rawResource = [handle, sourceUri, icons, tooltip, strikeThrough, faded] as SCMRawResource;
|
||||
|
||||
return { rawResource, handle };
|
||||
});
|
||||
|
||||
@@ -278,6 +278,7 @@ export class ExtHostPseudoterminal implements ITerminalChildProcess {
|
||||
}
|
||||
|
||||
this._pty.open(initialDimensions ? initialDimensions : undefined);
|
||||
this._onProcessReady.fire({ pid: -1, cwd: '' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
129
src/vs/workbench/api/common/extHostTimeline.ts
Normal file
129
src/vs/workbench/api/common/extHostTimeline.ts
Normal file
@@ -0,0 +1,129 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { UriComponents, URI } from 'vs/base/common/uri';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ExtHostTimelineShape, MainThreadTimelineShape, IMainContext, MainContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { TimelineItemWithSource, TimelineProvider } from 'vs/workbench/contrib/timeline/common/timeline';
|
||||
import { IDisposable, toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { CommandsConverter } from 'vs/workbench/api/common/extHostCommands';
|
||||
import { ThemeIcon } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
export interface IExtHostTimeline extends ExtHostTimelineShape {
|
||||
readonly _serviceBrand: undefined;
|
||||
$getTimeline(id: string, uri: UriComponents, token: vscode.CancellationToken): Promise<TimelineItemWithSource[]>;
|
||||
}
|
||||
|
||||
export const IExtHostTimeline = createDecorator<IExtHostTimeline>('IExtHostTimeline');
|
||||
|
||||
export class ExtHostTimeline implements IExtHostTimeline {
|
||||
_serviceBrand: undefined;
|
||||
|
||||
private _proxy: MainThreadTimelineShape;
|
||||
|
||||
private _providers = new Map<string, TimelineProvider>();
|
||||
|
||||
constructor(
|
||||
mainContext: IMainContext,
|
||||
) {
|
||||
this._proxy = mainContext.getProxy(MainContext.MainThreadTimeline);
|
||||
}
|
||||
|
||||
async $getTimeline(id: string, uri: UriComponents, token: vscode.CancellationToken): Promise<TimelineItemWithSource[]> {
|
||||
const provider = this._providers.get(id);
|
||||
return provider?.provideTimeline(URI.revive(uri), token) ?? [];
|
||||
}
|
||||
|
||||
registerTimelineProvider(provider: vscode.TimelineProvider, extensionId: ExtensionIdentifier, commandConverter: CommandsConverter): IDisposable {
|
||||
const timelineDisposables = new DisposableStore();
|
||||
|
||||
const convertTimelineItem = this.convertTimelineItem(provider.id, commandConverter, timelineDisposables);
|
||||
|
||||
let disposable: IDisposable | undefined;
|
||||
if (provider.onDidChange) {
|
||||
disposable = provider.onDidChange(this.emitTimelineChangeEvent(provider.id), this);
|
||||
}
|
||||
|
||||
return this.registerTimelineProviderCore({
|
||||
...provider,
|
||||
onDidChange: undefined,
|
||||
async provideTimeline(uri: URI, token: CancellationToken) {
|
||||
timelineDisposables.clear();
|
||||
|
||||
const results = await provider.provideTimeline(uri, token);
|
||||
// Intentional == we don't know how a provider will respond
|
||||
// eslint-disable-next-line eqeqeq
|
||||
return results != null
|
||||
? results.map(item => convertTimelineItem(item))
|
||||
: [];
|
||||
},
|
||||
dispose() {
|
||||
disposable?.dispose();
|
||||
timelineDisposables.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private convertTimelineItem(source: string, commandConverter: CommandsConverter, disposables: DisposableStore): (item: vscode.TimelineItem) => TimelineItemWithSource {
|
||||
return (item: vscode.TimelineItem) => {
|
||||
const { iconPath, ...props } = item;
|
||||
|
||||
let icon;
|
||||
let iconDark;
|
||||
let themeIcon;
|
||||
if (item.iconPath) {
|
||||
if (iconPath instanceof ThemeIcon) {
|
||||
themeIcon = { id: iconPath.id };
|
||||
}
|
||||
else if (URI.isUri(iconPath)) {
|
||||
icon = iconPath;
|
||||
iconDark = iconPath;
|
||||
}
|
||||
else {
|
||||
({ light: icon, dark: iconDark } = iconPath as { light: URI; dark: URI });
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
...props,
|
||||
source: source,
|
||||
command: item.command ? commandConverter.toInternal(item.command, disposables) : undefined,
|
||||
icon: icon,
|
||||
iconDark: iconDark,
|
||||
themeIcon: themeIcon
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
private emitTimelineChangeEvent(id: string) {
|
||||
return (e: vscode.TimelineChangeEvent) => {
|
||||
this._proxy.$emitTimelineChangeEvent({ ...e, id: id });
|
||||
};
|
||||
}
|
||||
|
||||
private registerTimelineProviderCore(provider: TimelineProvider): IDisposable {
|
||||
// console.log(`ExtHostTimeline#registerTimelineProvider: id=${provider.id}`);
|
||||
|
||||
const existing = this._providers.get(provider.id);
|
||||
if (existing) {
|
||||
throw new Error(`Timeline Provider ${provider.id} already exists.`);
|
||||
}
|
||||
|
||||
this._proxy.$registerTimelineProvider({
|
||||
id: provider.id,
|
||||
label: provider.label
|
||||
});
|
||||
this._providers.set(provider.id, provider);
|
||||
|
||||
return toDisposable(() => {
|
||||
this._providers.delete(provider.id);
|
||||
this._proxy.$unregisterTimelineProvider(provider.id);
|
||||
provider.dispose();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { ExtHostTunnelServiceShape } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import type * as vscode from 'vscode';
|
||||
import * as vscode from 'vscode';
|
||||
import { RemoteTunnel, TunnelOptions } from 'vs/platform/remote/common/tunnel';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
@@ -33,7 +33,7 @@ export interface IExtHostTunnelService extends ExtHostTunnelServiceShape {
|
||||
readonly _serviceBrand: undefined;
|
||||
openTunnel(forward: TunnelOptions): Promise<vscode.Tunnel | undefined>;
|
||||
getTunnels(): Promise<vscode.TunnelDescription[]>;
|
||||
onDidTunnelsChange: vscode.Event<void>;
|
||||
onDidChangeTunnels: vscode.Event<void>;
|
||||
setTunnelExtensionFunctions(provider: vscode.RemoteAuthorityResolver | undefined): Promise<IDisposable>;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export const IExtHostTunnelService = createDecorator<IExtHostTunnelService>('IEx
|
||||
|
||||
export class ExtHostTunnelService implements IExtHostTunnelService {
|
||||
_serviceBrand: undefined;
|
||||
onDidTunnelsChange: vscode.Event<void> = (new Emitter<void>()).event;
|
||||
onDidChangeTunnels: vscode.Event<void> = (new Emitter<void>()).event;
|
||||
|
||||
async openTunnel(forward: TunnelOptions): Promise<vscode.Tunnel | undefined> {
|
||||
return undefined;
|
||||
|
||||
@@ -2544,3 +2544,12 @@ export enum ColorThemeKind {
|
||||
}
|
||||
|
||||
//#endregion Theming
|
||||
|
||||
//#region Timeline
|
||||
|
||||
@es5ClassCompat
|
||||
export class TimelineItem implements vscode.TimelineItem {
|
||||
constructor(public label: string, public timestamp: number) { }
|
||||
}
|
||||
|
||||
//#endregion Timeline
|
||||
|
||||
@@ -25,7 +25,7 @@ import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import { Range, RelativePattern } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { ITextQueryBuilderOptions } from 'vs/workbench/contrib/search/common/queryBuilder';
|
||||
import { IRawFileMatch2, resultIsMatch } from 'vs/workbench/services/search/common/search';
|
||||
import type * as vscode from 'vscode';
|
||||
import * as vscode from 'vscode';
|
||||
import { ExtHostWorkspaceShape, IWorkspaceData, MainContext, MainThreadMessageServiceShape, MainThreadWorkspaceShape } from './extHost.protocol';
|
||||
|
||||
export interface IExtHostWorkspaceProvider {
|
||||
|
||||
@@ -309,7 +309,7 @@ namespace schema {
|
||||
type: 'string'
|
||||
},
|
||||
icon: {
|
||||
description: localize('vscode.extension.contributes.commandType.icon', '(Optional) Icon which is used to represent the command in the UI. Either a file path or a themable configuration'),
|
||||
description: localize('vscode.extension.contributes.commandType.icon', '(Optional) Icon which is used to represent the command in the UI. Either a file path, an object with file paths for dark and light themes, or a theme icon references, like `$(zap)`'),
|
||||
anyOf: [{
|
||||
type: 'string'
|
||||
},
|
||||
@@ -419,7 +419,7 @@ ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyM
|
||||
}
|
||||
|
||||
const menu = schema.parseMenuId(entry.key);
|
||||
if (typeof menu !== 'number') {
|
||||
if (typeof menu === 'undefined') {
|
||||
collector.warn(localize('menuId.invalid', "`{0}` is not a valid menu identifier", entry.key));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user