Merge branch 'master' into pr/90952

This commit is contained in:
João Moreno
2020-08-09 11:04:43 +02:00
124 changed files with 1886 additions and 877 deletions

View File

@@ -66,10 +66,10 @@ class MainThreadSCMResource implements ISCMResource {
private readonly sourceControlHandle: number,
private readonly groupHandle: number,
private readonly handle: number,
public sourceUri: URI,
public resourceGroup: ISCMResourceGroup,
public decorations: ISCMResourceDecorations,
public contextValue: string
readonly sourceUri: URI,
readonly resourceGroup: ISCMResourceGroup,
readonly decorations: ISCMResourceDecorations,
readonly contextValue: string | undefined
) { }
open(preserveFocus: boolean): Promise<void> {
@@ -151,18 +151,22 @@ class MainThreadSCMProvider implements ISCMProvider {
}
}
$registerGroup(handle: number, id: string, label: string): void {
const group = new MainThreadSCMResourceGroup(
this.handle,
handle,
this,
{},
label,
id
);
$registerGroups(_groups: [number /*handle*/, string /*id*/, string /*label*/, SCMGroupFeatures][]): void {
const groups = _groups.map(([handle, id, label, features]) => {
const group = new MainThreadSCMResourceGroup(
this.handle,
handle,
this,
features,
label,
id
);
this._groupsByHandle[handle] = group;
this.groups.splice(this.groups.elements.length, 0, [group]);
this._groupsByHandle[handle] = group;
return group;
});
this.groups.splice(this.groups.elements.length, 0, groups);
}
$updateGroup(handle: number, features: SCMGroupFeatures): void {
@@ -218,7 +222,7 @@ class MainThreadSCMProvider implements ISCMProvider {
URI.revive(sourceUri),
group,
decorations,
contextValue
contextValue || undefined
);
});
@@ -328,7 +332,7 @@ export class MainThreadSCM implements MainThreadSCMShape {
this._repositories.delete(handle);
}
$registerGroup(sourceControlHandle: number, groupHandle: number, id: string, label: string): void {
$registerGroups(sourceControlHandle: number, groups: [number /*handle*/, string /*id*/, string /*label*/, SCMGroupFeatures][], splices: SCMRawResourceSplices[]): void {
const repository = this._repositories.get(sourceControlHandle);
if (!repository) {
@@ -336,7 +340,8 @@ export class MainThreadSCM implements MainThreadSCMShape {
}
const provider = repository.provider as MainThreadSCMProvider;
provider.$registerGroup(groupHandle, id, label);
provider.$registerGroups(groups);
provider.$spliceGroupResourceStates(splices);
}
$updateGroup(sourceControlHandle: number, groupHandle: number, features: SCMGroupFeatures): void {

View File

@@ -127,8 +127,9 @@ const viewDescriptor: IJSONSchema = {
'hidden',
'collapsed'
],
default: 'visible',
enumDescriptions: [
localize('vscode.extension.contributes.view.initialState.visible', "The default initial state for view. The view will be expanded. This may have different behavior when the view container that the view is in is built in."),
localize('vscode.extension.contributes.view.initialState.visible', "The default initial state for the view. In most containers the view will be expanded, however; some built-in containers (explorer, scm, and debug) show all contributed views collapsed regardless of the `visibility`."),
localize('vscode.extension.contributes.view.initialState.hidden', "The view will not be shown in the view container, but will be discoverable through the views menu and other view entry points and can be un-hidden by the user."),
localize('vscode.extension.contributes.view.initialState.collapsed', "The view will show in the view container, but will be collapsed.")
]

View File

@@ -205,7 +205,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
get providers(): ReadonlyArray<vscode.AuthenticationProviderInformation> {
return extHostAuthentication.providers;
},
getSession(providerId: string, scopes: string[], options: vscode.AuthenticationGetSessionOptions) {
getSession(providerId: string, scopes: string[], options?: vscode.AuthenticationGetSessionOptions) {
return extHostAuthentication.getSession(extension, providerId, scopes, options as any);
},
logout(providerId: string, sessionId: string): Thenable<void> {
@@ -870,7 +870,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
}
return extHostDebugService.startDebugging(folder, nameOrConfig, parentSessionOrOptions || {});
},
stopDebugging(session: vscode.DebugSession | undefined) {
stopDebugging(session?: vscode.DebugSession) {
return extHostDebugService.stopDebugging(session);
},
addBreakpoints(breakpoints: vscode.Breakpoint[]) {

View File

@@ -838,7 +838,7 @@ export interface MainThreadSCMShape extends IDisposable {
$updateSourceControl(handle: number, features: SCMProviderFeatures): void;
$unregisterSourceControl(handle: number): void;
$registerGroup(sourceControlHandle: number, handle: number, id: string, label: string): void;
$registerGroups(sourceControlHandle: number, groups: [number /*handle*/, string /*id*/, string /*label*/, SCMGroupFeatures][], splices: SCMRawResourceSplices[]): void;
$updateGroup(sourceControlHandle: number, handle: number, features: SCMGroupFeatures): void;
$updateGroupLabel(sourceControlHandle: number, handle: number, label: string): void;
$unregisterGroup(sourceControlHandle: number, handle: number): void;

View File

@@ -41,7 +41,7 @@ export class ExtHostAuthentication implements ExtHostAuthenticationShape {
}
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopes: string[], options: vscode.AuthenticationGetSessionOptions & { createIfNone: true }): Promise<vscode.AuthenticationSession>;
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopes: string[], options: vscode.AuthenticationGetSessionOptions): Promise<vscode.AuthenticationSession | undefined> {
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopes: string[], options: vscode.AuthenticationGetSessionOptions = {}): Promise<vscode.AuthenticationSession | undefined> {
await this._proxy.$ensureProvider(providerId);
const provider = this._authenticationProviders.get(providerId);
const extensionName = requestingExtension.displayName || requestingExtension.name;

View File

@@ -51,7 +51,7 @@ export interface IExtHostDebugService extends ExtHostDebugServiceShape {
addBreakpoints(breakpoints0: vscode.Breakpoint[]): Promise<void>;
removeBreakpoints(breakpoints0: vscode.Breakpoint[]): Promise<void>;
startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration, options: vscode.DebugSessionOptions): Promise<boolean>;
stopDebugging(session: vscode.DebugSession | undefined): Promise<void>;
stopDebugging(session?: vscode.DebugSession): Promise<void>;
registerDebugConfigurationProvider(type: string, provider: vscode.DebugConfigurationProvider, trigger: vscode.DebugConfigurationProviderTriggerKind): vscode.Disposable;
registerDebugAdapterDescriptorFactory(extension: IExtensionDescription, type: string, factory: vscode.DebugAdapterDescriptorFactory): vscode.Disposable;
registerDebugAdapterTrackerFactory(type: string, factory: vscode.DebugAdapterTrackerFactory): vscode.Disposable;
@@ -302,7 +302,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
});
}
public stopDebugging(session: vscode.DebugSession | undefined): Promise<void> {
public stopDebugging(session?: vscode.DebugSession): Promise<void> {
return this._debugServiceProxy.$stopDebugging(session ? session.id : undefined);
}

View File

@@ -6,10 +6,10 @@
import { URI, UriComponents } from 'vs/base/common/uri';
import { Event, Emitter } from 'vs/base/common/event';
import { debounce } from 'vs/base/common/decorators';
import { DisposableStore, MutableDisposable } from 'vs/base/common/lifecycle';
import { DisposableStore, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
import { asPromise } from 'vs/base/common/async';
import { ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
import { MainContext, MainThreadSCMShape, SCMRawResource, SCMRawResourceSplice, SCMRawResourceSplices, IMainContext, ExtHostSCMShape, ICommandDto, MainThreadTelemetryShape } from './extHost.protocol';
import { MainContext, MainThreadSCMShape, SCMRawResource, SCMRawResourceSplice, SCMRawResourceSplices, IMainContext, ExtHostSCMShape, ICommandDto, MainThreadTelemetryShape, SCMGroupFeatures } from './extHost.protocol';
import { sortedDiff, equals } from 'vs/base/common/arrays';
import { comparePaths } from 'vs/base/common/comparers';
import type * as vscode from 'vscode';
@@ -228,6 +228,9 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
private readonly _onDidUpdateResourceStates = new Emitter<void>();
readonly onDidUpdateResourceStates = this._onDidUpdateResourceStates.event;
private _disposed = false;
get disposed(): boolean { return this._disposed; }
private readonly _onDidDispose = new Emitter<void>();
readonly onDidDispose = this._onDidDispose.event;
@@ -246,7 +249,13 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
get hideWhenEmpty(): boolean | undefined { return this._hideWhenEmpty; }
set hideWhenEmpty(hideWhenEmpty: boolean | undefined) {
this._hideWhenEmpty = hideWhenEmpty;
this._proxy.$updateGroup(this._sourceControlHandle, this.handle, { hideWhenEmpty });
this._proxy.$updateGroup(this._sourceControlHandle, this.handle, this.features);
}
get features(): SCMGroupFeatures {
return {
hideWhenEmpty: this.hideWhenEmpty
};
}
get resourceStates(): vscode.SourceControlResourceState[] { return [...this._resourceStates]; }
@@ -263,9 +272,7 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
private _sourceControlHandle: number,
private _id: string,
private _label: string,
) {
this._proxy.$registerGroup(_sourceControlHandle, this.handle, _id, _label);
}
) { }
getResourceState(handle: number): vscode.SourceControlResourceState | undefined {
return this._resourceStatesMap.get(handle);
@@ -341,7 +348,7 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
}
dispose(): void {
this._proxy.$unregisterGroup(this._sourceControlHandle, this.handle);
this._disposed = true;
this._onDidDispose.fire();
}
}
@@ -466,26 +473,51 @@ class ExtHostSourceControl implements vscode.SourceControl {
this._proxy.$registerSourceControl(this.handle, _id, _label, _rootUri);
}
private createdResourceGroups = new Map<ExtHostSourceControlResourceGroup, IDisposable>();
private updatedResourceGroups = new Set<ExtHostSourceControlResourceGroup>();
createResourceGroup(id: string, label: string): ExtHostSourceControlResourceGroup {
const group = new ExtHostSourceControlResourceGroup(this._proxy, this._commands, this.handle, id, label);
const updateListener = group.onDidUpdateResourceStates(() => {
this.updatedResourceGroups.add(group);
this.eventuallyUpdateResourceStates();
});
Event.once(group.onDidDispose)(() => {
this.updatedResourceGroups.delete(group);
updateListener.dispose();
this._groups.delete(group.handle);
});
this._groups.set(group.handle, group);
const disposable = Event.once(group.onDidDispose)(() => this.createdResourceGroups.delete(group));
this.createdResourceGroups.set(group, disposable);
this.eventuallyAddResourceGroups();
return group;
}
@debounce(100)
eventuallyAddResourceGroups(): void {
const groups: [number /*handle*/, string /*id*/, string /*label*/, SCMGroupFeatures][] = [];
const splices: SCMRawResourceSplices[] = [];
for (const [group, disposable] of this.createdResourceGroups) {
disposable.dispose();
const updateListener = group.onDidUpdateResourceStates(() => {
this.updatedResourceGroups.add(group);
this.eventuallyUpdateResourceStates();
});
Event.once(group.onDidDispose)(() => {
this.updatedResourceGroups.delete(group);
updateListener.dispose();
this._groups.delete(group.handle);
this._proxy.$unregisterGroup(this.handle, group.handle);
});
groups.push([group.handle, group.id, group.label, group.features]);
const snapshot = group._takeResourceStateSnapshot();
if (snapshot.length > 0) {
splices.push([group.handle, snapshot]);
}
this._groups.set(group.handle, group);
}
this._proxy.$registerGroups(this.handle, groups, splices);
}
@debounce(100)
eventuallyUpdateResourceStates(): void {
const splices: SCMRawResourceSplices[] = [];

View File

@@ -288,7 +288,7 @@ namespace schema {
type: 'string'
},
group: {
description: localize('vscode.extension.contributes.menuItem.group', 'Group into which this command belongs'),
description: localize('vscode.extension.contributes.menuItem.group', 'Group into which this item belongs'),
type: 'string'
}
}
@@ -307,7 +307,7 @@ namespace schema {
type: 'string'
},
group: {
description: localize('vscode.extension.contributes.menuItem.group', 'Group into which this command belongs'),
description: localize('vscode.extension.contributes.menuItem.group', 'Group into which this item belongs'),
type: 'string'
}
}