Merge from vscode 61d5f2b82f17bf9f99f56405204caab88a7e8747

This commit is contained in:
ADS Merger
2020-03-19 06:57:07 +00:00
parent 03ce5d1ba7
commit 84f67f61c4
137 changed files with 13234 additions and 796 deletions

View File

@@ -54,6 +54,7 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { IQuickAccessRegistry, Extensions as QuickAccessExtensions } from 'vs/platform/quickinput/common/quickAccess';
import { StartDebugQuickAccessProvider } from 'vs/workbench/contrib/debug/browser/debugQuickAccess';
import { DebugProgressContribution } from 'vs/workbench/contrib/debug/browser/debugProgress';
class OpenDebugViewletAction extends ShowViewletAction {
public static readonly ID = VIEWLET_ID;
@@ -298,6 +299,7 @@ configurationRegistry.registerConfiguration({
// Register Debug Status
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugStatusContribution, LifecyclePhase.Eventually);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugProgressContribution, LifecyclePhase.Eventually);
// Debug toolbar

View File

@@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Event } from 'vs/base/common/event';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IDebugService, VIEWLET_ID, IDebugSession } from 'vs/workbench/contrib/debug/common/debug';
import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
export class DebugProgressContribution implements IWorkbenchContribution {
private toDispose: IDisposable[] = [];
constructor(
@IDebugService private readonly debugService: IDebugService,
@IProgressService private readonly progressService: IProgressService
) {
let progressListener: IDisposable;
const onFocusSession = (session: IDebugSession | undefined) => {
if (progressListener) {
progressListener.dispose();
}
if (session) {
progressListener = session.onDidProgressStart(async progressStartEvent => {
const promise = new Promise<void>(r => {
// Show progress until a progress end event comes or the session ends
const listener = Event.any(Event.filter(session.onDidProgressEnd, e => e.body.progressId === progressStartEvent.body.progressId),
session.onDidEndAdapter)(() => {
listener.dispose();
r();
});
});
this.progressService.withProgress({ location: VIEWLET_ID }, () => promise);
this.progressService.withProgress({
location: ProgressLocation.Notification,
title: progressStartEvent.body.title,
cancellable: progressStartEvent.body.cancellable,
silent: true
}, () => promise, () => session.cancel(progressStartEvent.body.progressId));
});
}
};
this.toDispose.push(this.debugService.getViewModel().onDidFocusSession(onFocusSession));
onFocusSession(this.debugService.getViewModel().focusedSession);
}
dispose(): void {
dispose(this.toDispose);
}
}

View File

@@ -603,6 +603,14 @@ export class DebugSession implements IDebugSession {
}, token);
}
async cancel(progressId: string): Promise<DebugProtocol.CancelResponse> {
if (!this.raw) {
return Promise.reject(new Error(localize('noDebugAdapter', "No debug adapter, can not send '{0}'", 'cancel')));
}
return this.raw.cancel({ progressId });
}
//---- threads
getThread(threadId: number): Thread | undefined {

View File

@@ -120,6 +120,7 @@ export class DebugViewPaneContainer extends ViewPaneContainer {
if (CONTEXT_DEBUG_UX.getValue(this.contextKeyService) === 'simple') {
return [];
}
if (!this.showInitialDebugActions) {
if (!this.debugToolBarMenu) {
@@ -185,7 +186,7 @@ export class DebugViewPaneContainer extends ViewPaneContainer {
}
if (state === State.Initializing) {
this.progressService.withProgress({ location: VIEWLET_ID }, _progress => {
this.progressService.withProgress({ location: VIEWLET_ID, }, _progress => {
return new Promise(resolve => this.progressResolve = resolve);
});
}

View File

@@ -223,6 +223,7 @@ export interface IDebugSession extends ITreeElement {
variables(variablesReference: number, threadId: number | undefined, filter: 'indexed' | 'named' | undefined, start: number | undefined, count: number | undefined): Promise<DebugProtocol.VariablesResponse>;
evaluate(expression: string, frameId?: number, context?: string): Promise<DebugProtocol.EvaluateResponse>;
customRequest(request: string, args: any): Promise<DebugProtocol.Response>;
cancel(progressId: string): Promise<DebugProtocol.CancelResponse>;
restartFrame(frameId: number, threadId: number): Promise<void>;
next(threadId: number): Promise<void>;

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/** Declaration module describing the VS Code debug protocol.
Auto-generated from json schema. Do not edit manually.
*/
@@ -72,13 +72,12 @@ declare module DebugProtocol {
/** Cancel request; value of command field is 'cancel'.
The 'cancel' request is used by the frontend in two situations:
- to indicate that it is no longer interested in the result produced by a specific request issued earlier
- to cancel a progress indicator.
- to cancel a progress sequence.
This request has a hint characteristic: a debug adapter can only be expected to make a 'best effort' in honouring this request but there are no guarantees.
The 'cancel' request may return an error if it could not cancel an operation but a frontend should refrain from presenting this error to end users.
A frontend client should only call this request if the capability 'supportsCancelRequest' is true.
The request that got canceled still needs to send a response back.
This can either be a normal result ('success' attribute true) or an error response ('success' attribute false and the 'message' set to 'cancelled').
Returning partial results from a cancelled request is possible but please note that a frontend client has no generic way for detecting that a response is partial or not.
The request that got canceled still needs to send a response back. This can either be a normal result ('success' attribute true) or an error response ('success' attribute false and the 'message' set to 'cancelled'). Returning partial results from a cancelled request is possible but please note that a frontend client has no generic way for detecting that a response is partial or not.
The progress that got cancelled still needs to send a 'progressEnd' event back. A client should not assume that progress just got cancelled after sending the 'cancel' request.
*/
export interface CancelRequest extends Request {
// command: 'cancel';

View File

@@ -134,6 +134,10 @@ export class MockDebugService implements IDebugService {
export class MockSession implements IDebugSession {
cancel(_progressId: string): Promise<DebugProtocol.CancelResponse> {
throw new Error('Method not implemented.');
}
breakpointsLocations(uri: uri, lineNumber: number): Promise<IPosition[]> {
throw new Error('Method not implemented.');
}