Merge from vscode e6a45f4242ebddb7aa9a229f85555e8a3bd987e2 (#9253)

* Merge from vscode e6a45f4242ebddb7aa9a229f85555e8a3bd987e2

* skip failing tests

* remove github-authentication extensions

* ignore github compile steps

* ignore github compile steps

* check in compiled files
This commit is contained in:
Anthony Dresser
2020-02-21 12:11:51 -08:00
committed by GitHub
parent c74bac3746
commit 1b78a9b1e0
179 changed files with 3200 additions and 1830 deletions

View File

@@ -250,6 +250,11 @@ configurationRegistry.registerConfiguration({
description: nls.localize('debug.console.wordWrap', "Controls if the lines should wrap in the debug console."),
default: true
},
'debug.console.historySuggestions': {
type: 'boolean',
description: nls.localize('debug.console.historySuggestions', "Controls if the debug console should suggest previously typed input."),
default: true
},
'launch': {
type: 'object',
description: nls.localize({ comment: ['This is the description for a setting'], key: 'launch' }, "Global debug launch configuration. Should be used as an alternative to 'launch.json' that is shared across workspaces."),

View File

@@ -832,6 +832,17 @@ export class DebugSession implements IDebugSession {
column: event.body.column ? event.body.column : 1,
source: this.getSource(event.body.source)
} : undefined;
if (event.body.group === 'start' || event.body.group === 'startCollapsed') {
const expanded = event.body.group === 'start';
this.repl.startGroup(event.body.output || '', expanded, source);
return;
}
if (event.body.group === 'end') {
this.repl.endGroup();
// Do not return, the end event can have additional output in it
}
if (event.body.variablesReference) {
const container = new ExpressionContainer(this, undefined, event.body.variablesReference, generateUuid());
outpuPromises.push(container.getChildren().then(async children => {

View File

@@ -51,12 +51,13 @@ import { RunOnceScheduler } from 'vs/base/common/async';
import { FuzzyScore } from 'vs/base/common/filters';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { PANEL_BACKGROUND } from 'vs/workbench/common/theme';
import { ReplDelegate, ReplVariablesRenderer, ReplSimpleElementsRenderer, ReplEvaluationInputsRenderer, ReplEvaluationResultsRenderer, ReplRawObjectsRenderer, ReplDataSource, ReplAccessibilityProvider } from 'vs/workbench/contrib/debug/browser/replViewer';
import { ReplDelegate, ReplVariablesRenderer, ReplSimpleElementsRenderer, ReplEvaluationInputsRenderer, ReplEvaluationResultsRenderer, ReplRawObjectsRenderer, ReplDataSource, ReplAccessibilityProvider, ReplGroupRenderer } from 'vs/workbench/contrib/debug/browser/replViewer';
import { localize } from 'vs/nls';
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IViewsService, IViewDescriptorService } from 'vs/workbench/common/views';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { ReplGroup } from 'vs/workbench/contrib/debug/common/replModel';
const $ = dom.$;
@@ -157,14 +158,16 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
});
}
const history = this.history.getHistory();
history.forEach(h => suggestions.push({
label: h,
insertText: h,
kind: CompletionItemKind.Text,
range: computeRange(h.length),
sortText: 'ZZZ'
}));
if (this.configurationService.getValue<IDebugConfiguration>('debug').console.historySuggestions) {
const history = this.history.getHistory();
history.forEach(h => suggestions.push({
label: h,
insertText: h,
kind: CompletionItemKind.Text,
range: computeRange(h.length),
sortText: 'ZZZ'
}));
}
return { suggestions };
}
@@ -423,6 +426,16 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
const lastElementVisible = this.tree.scrollTop + this.tree.renderHeight >= this.tree.scrollHeight;
await this.tree.updateChildren();
const session = this.tree.getInput();
if (session) {
const replElements = session.getReplElements();
const lastElement = replElements.length ? replElements[replElements.length - 1] : undefined;
if (lastElement instanceof ReplGroup && lastElement.autoExpand) {
await this.tree.expand(lastElement);
}
}
if (lastElementVisible) {
// Only scroll if we were scrolled all the way down before tree refreshed #10486
revealLastElement(this.tree);
@@ -452,6 +465,7 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
this.instantiationService.createInstance(ReplVariablesRenderer, linkDetector),
this.instantiationService.createInstance(ReplSimpleElementsRenderer, linkDetector),
new ReplEvaluationInputsRenderer(),
new ReplGroupRenderer(),
new ReplEvaluationResultsRenderer(linkDetector),
new ReplRawObjectsRenderer(linkDetector),
],

View File

@@ -7,7 +7,7 @@ import severity from 'vs/base/common/severity';
import * as dom from 'vs/base/browser/dom';
import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { Variable } from 'vs/workbench/contrib/debug/common/debugModel';
import { SimpleReplElement, RawObjectReplElement, ReplEvaluationInput, ReplEvaluationResult } from 'vs/workbench/contrib/debug/common/replModel';
import { SimpleReplElement, RawObjectReplElement, ReplEvaluationInput, ReplEvaluationResult, ReplGroup } from 'vs/workbench/contrib/debug/common/replModel';
import { CachedListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { ITreeRenderer, ITreeNode, IAsyncDataSource } from 'vs/base/browser/ui/tree/tree';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -30,6 +30,10 @@ interface IReplEvaluationInputTemplateData {
label: HighlightedLabel;
}
interface IReplGroupTemplateData {
label: HighlightedLabel;
}
interface IReplEvaluationResultTemplateData {
value: HTMLElement;
annotation: HTMLElement;
@@ -76,6 +80,29 @@ export class ReplEvaluationInputsRenderer implements ITreeRenderer<ReplEvaluatio
}
}
export class ReplGroupRenderer implements ITreeRenderer<ReplGroup, FuzzyScore, IReplGroupTemplateData> {
static readonly ID = 'replGroup';
get templateId(): string {
return ReplGroupRenderer.ID;
}
renderTemplate(container: HTMLElement): IReplEvaluationInputTemplateData {
const input = dom.append(container, $('.expression'));
const label = new HighlightedLabel(input, false);
return { label };
}
renderElement(element: ITreeNode<ReplGroup, FuzzyScore>, _index: number, templateData: IReplGroupTemplateData): void {
const replGroup = element.element;
templateData.label.set(replGroup.name, createMatches(element.filterData));
}
disposeTemplate(_templateData: IReplEvaluationInputTemplateData): void {
// noop
}
}
export class ReplEvaluationResultsRenderer implements ITreeRenderer<ReplEvaluationResult, FuzzyScore, IReplEvaluationResultTemplateData> {
static readonly ID = 'replEvaluationResult';
@@ -296,6 +323,9 @@ export class ReplDelegate extends CachedListVirtualDelegate<IReplElement> {
// Variable with no name is a top level variable which should be rendered like a repl element #17404
return ReplSimpleElementsRenderer.ID;
}
if (element instanceof ReplGroup) {
return ReplGroupRenderer.ID;
}
return ReplRawObjectsRenderer.ID;
}
@@ -317,7 +347,7 @@ export class ReplDataSource implements IAsyncDataSource<IDebugSession, IReplElem
return true;
}
return !!(<IExpressionContainer>element).hasChildren;
return !!(<IExpressionContainer | ReplGroup>element).hasChildren;
}
getChildren(element: IReplElement | IDebugSession): Promise<IReplElement[]> {
@@ -327,6 +357,9 @@ export class ReplDataSource implements IAsyncDataSource<IDebugSession, IReplElem
if (element instanceof RawObjectReplElement) {
return element.getChildren();
}
if (element instanceof ReplGroup) {
return Promise.resolve(element.getChildren());
}
return (<IExpression>element).getChildren();
}
@@ -343,6 +376,9 @@ export class ReplAccessibilityProvider implements IAccessibilityProvider<IReplEl
if (element instanceof RawObjectReplElement) {
return localize('replRawObjectAriaLabel', "Repl variable {0} has value {1}, read eval print loop, debug", element.name, element.value);
}
if (element instanceof ReplGroup) {
return localize('replGroup', "Repl group {0}, read eval print loop, debug", element.name);
}
return '';
}

View File

@@ -462,6 +462,7 @@ export interface IDebugConfiguration {
lineHeight: number;
wordWrap: boolean;
closeOnEnd: boolean;
historySuggestions: boolean;
};
focusWindowOnBreak: boolean;
onTaskErrors: 'debugAnyway' | 'showErrors' | 'prompt' | 'abort';

View File

@@ -120,6 +120,60 @@ export class ReplEvaluationResult extends ExpressionContainer implements IReplEl
}
}
export class ReplGroup implements IReplElement {
private children: IReplElement[] = [];
private id: string;
private ended = false;
static COUNTER = 0;
constructor(
public name: string,
public autoExpand: boolean,
public sourceData?: IReplElementSource
) {
this.id = `replGroup:${ReplGroup.COUNTER++}`;
}
get hasChildren() {
return true;
}
getId(): string {
return this.id;
}
toString(): string {
return this.name;
}
addChild(child: IReplElement): void {
const lastElement = this.children.length ? this.children[this.children.length - 1] : undefined;
if (lastElement instanceof ReplGroup && !lastElement.hasEnded) {
lastElement.addChild(child);
} else {
this.children.push(child);
}
}
getChildren(): IReplElement[] {
return this.children;
}
end(): void {
const lastElement = this.children.length ? this.children[this.children.length - 1] : undefined;
if (lastElement instanceof ReplGroup && !lastElement.hasEnded) {
lastElement.end();
} else {
this.ended = true;
}
}
get hasEnded(): boolean {
return this.ended;
}
}
export class ReplModel {
private replElements: IReplElement[] = [];
private readonly _onDidChangeElements = new Emitter<void>();
@@ -162,11 +216,29 @@ export class ReplModel {
}
}
private addReplElement(newElement: IReplElement): void {
this.replElements.push(newElement);
if (this.replElements.length > MAX_REPL_LENGTH) {
this.replElements.splice(0, this.replElements.length - MAX_REPL_LENGTH);
startGroup(name: string, autoExpand: boolean, sourceData?: IReplElementSource): void {
const group = new ReplGroup(name, autoExpand, sourceData);
this.addReplElement(group);
}
endGroup(): void {
const lastElement = this.replElements[this.replElements.length - 1];
if (lastElement instanceof ReplGroup) {
lastElement.end();
}
}
private addReplElement(newElement: IReplElement): void {
const lastElement = this.replElements.length ? this.replElements[this.replElements.length - 1] : undefined;
if (lastElement instanceof ReplGroup && !lastElement.hasEnded) {
lastElement.addChild(newElement);
} else {
this.replElements.push(newElement);
if (this.replElements.length > MAX_REPL_LENGTH) {
this.replElements.splice(0, this.replElements.length - MAX_REPL_LENGTH);
}
}
this._onDidChangeElements.fire();
}

View File

@@ -319,7 +319,7 @@ suite('Debug - Breakpoints', () => {
test('decorations', () => {
const modelUri = uri.file('/myfolder/my file first.js');
const languageIdentifier = new LanguageIdentifier('testMode', LanguageId.PlainText);
const textModel = new TextModel(
const textModel = TextModel.createFromString(
['this is line one', 'this is line two', ' this is line three it has whitespace at start', 'this is line four', 'this is line five'].join('\n'),
TextModel.DEFAULT_CREATION_OPTIONS,
languageIdentifier

View File

@@ -8,7 +8,7 @@ import * as assert from 'assert';
import severity from 'vs/base/common/severity';
import { DebugModel, StackFrame, Thread } from 'vs/workbench/contrib/debug/common/debugModel';
import { MockRawSession, MockDebugAdapter } from 'vs/workbench/contrib/debug/test/common/mockDebug';
import { SimpleReplElement, RawObjectReplElement, ReplEvaluationInput, ReplModel, ReplEvaluationResult } from 'vs/workbench/contrib/debug/common/replModel';
import { SimpleReplElement, RawObjectReplElement, ReplEvaluationInput, ReplModel, ReplEvaluationResult, ReplGroup } from 'vs/workbench/contrib/debug/common/replModel';
import { RawDebugSession } from 'vs/workbench/contrib/debug/browser/rawDebugSession';
import { timeout } from 'vs/base/common/async';
import { createMockSession } from 'vs/workbench/contrib/debug/test/browser/callStack.test';
@@ -151,4 +151,42 @@ suite('Debug - REPL', () => {
assert.equal((<ReplEvaluationResult>session.getReplElements()[4]).value, '=after.2');
assert.equal((<SimpleReplElement>session.getReplElements()[5]).value, 'after.2');
});
test('repl groups', async () => {
const session = createMockSession(model);
const repl = new ReplModel();
repl.appendToRepl(session, 'first global line', severity.Info);
repl.startGroup('group_1', true);
repl.appendToRepl(session, 'first line in group', severity.Info);
repl.appendToRepl(session, 'second line in group', severity.Info);
const elements = repl.getReplElements();
assert.equal(elements.length, 2);
const group = elements[1] as ReplGroup;
assert.equal(group.name, 'group_1');
assert.equal(group.autoExpand, true);
assert.equal(group.hasChildren, true);
assert.equal(group.hasEnded, false);
repl.startGroup('group_2', false);
repl.appendToRepl(session, 'first line in subgroup', severity.Info);
repl.appendToRepl(session, 'second line in subgroup', severity.Info);
const children = group.getChildren();
assert.equal(children.length, 3);
assert.equal((<SimpleReplElement>children[0]).value, 'first line in group');
assert.equal((<SimpleReplElement>children[1]).value, 'second line in group');
assert.equal((<ReplGroup>children[2]).name, 'group_2');
assert.equal((<ReplGroup>children[2]).hasEnded, false);
assert.equal((<ReplGroup>children[2]).getChildren().length, 2);
repl.endGroup();
assert.equal((<ReplGroup>children[2]).hasEnded, true);
repl.appendToRepl(session, 'third line in group', severity.Info);
assert.equal(group.getChildren().length, 4);
assert.equal(group.hasEnded, false);
repl.endGroup();
assert.equal(group.hasEnded, true);
repl.appendToRepl(session, 'second global line', severity.Info);
assert.equal(repl.getReplElements().length, 3);
assert.equal((<SimpleReplElement>repl.getReplElements()[2]).value, 'second global line');
});
});