mirror of
https://github.com/Microsoft/vscode
synced 2024-10-05 19:02:54 +00:00
Implemented Requested small changes.
Removed linkDetector check when rendering the type. Deleted displayType boolean, now we read from config in render Added missing line to renderExpressionElement. Co-authored-by: Diogo Pinto <diogotfpinto@tecnico.ulisboa.pt>
This commit is contained in:
parent
8219ce7cec
commit
97e2d0d918
|
@ -138,15 +138,7 @@ export function renderVariable(store: DisposableStore, commandService: ICommandS
|
|||
if (variable.value && typeof variable.name === 'string') {
|
||||
if (variable.type && displayType) {
|
||||
text += ': ';
|
||||
//render type
|
||||
const type = variable.type + ' =';
|
||||
if (linkDetector) {
|
||||
data.type.textContent = '';
|
||||
const session = (variable instanceof ExpressionContainer) ? variable.getSession() : undefined;
|
||||
data.type.appendChild(linkDetector.linkify(type, false, session ? session.root : undefined, true));
|
||||
} else {
|
||||
data.type.textContent = type;
|
||||
}
|
||||
data.type.textContent = variable.type + ' =';
|
||||
} else {
|
||||
text += ' =';
|
||||
}
|
||||
|
@ -275,6 +267,7 @@ export abstract class AbstractExpressionsRenderer<T = IExpression> implements IT
|
|||
public abstract renderElement(node: ITreeNode<T, FuzzyScore>, index: number, data: IExpressionTemplateData): void;
|
||||
|
||||
protected renderExpressionElement(element: IExpression, node: ITreeNode<T, FuzzyScore>, data: IExpressionTemplateData): void {
|
||||
data.currentElement = element;
|
||||
this.renderExpression(node.element, data, createMatches(node.filterData));
|
||||
if (data.actionBar) {
|
||||
this.renderActionBar!(data.actionBar, element, data);
|
||||
|
|
|
@ -134,7 +134,7 @@ export class DebugHoverWidget implements IContentWidget {
|
|||
const dataSource = this.instantiationService.createInstance(DebugHoverDataSource);
|
||||
const linkeDetector = this.instantiationService.createInstance(LinkDetector);
|
||||
this.tree = <WorkbenchAsyncDataTree<IExpression, IExpression, any>>this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'DebugHover', this.treeContainer, new DebugHoverDelegate(), [
|
||||
this.instantiationService.createInstance(VariablesRenderer, linkeDetector, false),
|
||||
this.instantiationService.createInstance(VariablesRenderer, linkeDetector),
|
||||
this.instantiationService.createInstance(VisualizedVariableRenderer, linkeDetector),
|
||||
],
|
||||
dataSource, {
|
||||
|
|
|
@ -123,10 +123,9 @@ export class VariablesView extends ViewPane {
|
|||
container.classList.add('debug-variables');
|
||||
const treeContainer = renderViewTree(container);
|
||||
const linkDetector = this.instantiationService.createInstance(LinkDetector);
|
||||
const displayType: boolean = this.configurationService.getValue<IDebugConfiguration>('debug').showVariableTypes;
|
||||
this.tree = <WorkbenchAsyncDataTree<IStackFrame | null, IExpression | IScope, FuzzyScore>>this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'VariablesView', treeContainer, new VariablesDelegate(),
|
||||
[
|
||||
this.instantiationService.createInstance(VariablesRenderer, linkDetector, displayType),
|
||||
this.instantiationService.createInstance(VariablesRenderer, linkDetector),
|
||||
this.instantiationService.createInstance(VisualizedVariableRenderer, linkDetector),
|
||||
new ScopesRenderer(),
|
||||
new ScopeErrorRenderer(),
|
||||
|
@ -457,7 +456,6 @@ export class VisualizedVariableRenderer extends AbstractExpressionsRenderer {
|
|||
|
||||
public override renderElement(node: ITreeNode<IExpression, FuzzyScore>, index: number, data: IExpressionTemplateData): void {
|
||||
data.elementDisposable.clear();
|
||||
data.currentElement = node.element;
|
||||
super.renderExpressionElement(node.element, node, data);
|
||||
}
|
||||
|
||||
|
@ -526,7 +524,6 @@ export class VariablesRenderer extends AbstractExpressionsRenderer {
|
|||
|
||||
constructor(
|
||||
private readonly linkDetector: LinkDetector,
|
||||
private displayType: boolean,
|
||||
@IMenuService private readonly menuService: IMenuService,
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
@IDebugVisualizerService private readonly visualization: IDebugVisualizerService,
|
||||
|
@ -545,15 +542,14 @@ export class VariablesRenderer extends AbstractExpressionsRenderer {
|
|||
}
|
||||
|
||||
protected renderExpression(expression: IExpression, data: IExpressionTemplateData, highlights: IHighlight[]): void {
|
||||
renderVariable(data.elementDisposable, this.commandService, this.hoverService, expression as Variable, data, true, highlights, this.linkDetector, this.displayType);
|
||||
const showType = this.configurationService.getValue<IDebugConfiguration>('debug').showVariableTypes;
|
||||
renderVariable(data.elementDisposable, this.commandService, this.hoverService, expression as Variable, data, true, highlights, this.linkDetector, showType);
|
||||
}
|
||||
|
||||
public override renderElement(node: ITreeNode<IExpression, FuzzyScore>, index: number, data: IExpressionTemplateData): void {
|
||||
data.elementDisposable.clear();
|
||||
data.currentElement = node.element;
|
||||
data.elementDisposable.add(this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration('debug.showVariableTypes')) {
|
||||
this.displayType = this.configurationService.getValue<IDebugConfiguration>('debug').showVariableTypes;
|
||||
super.renderExpressionElement(node.element, node, data);
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -86,14 +86,13 @@ export class WatchExpressionsView extends ViewPane {
|
|||
this.element.classList.add('debug-pane');
|
||||
container.classList.add('debug-watch');
|
||||
const treeContainer = renderViewTree(container);
|
||||
const watchDisplayType: boolean = this.configurationService.getValue<IDebugConfiguration>('debug').showVariableTypes;
|
||||
|
||||
const expressionsRenderer = this.instantiationService.createInstance(WatchExpressionsRenderer, watchDisplayType);
|
||||
const expressionsRenderer = this.instantiationService.createInstance(WatchExpressionsRenderer);
|
||||
const linkDetector = this.instantiationService.createInstance(LinkDetector);
|
||||
this.tree = <WorkbenchAsyncDataTree<IDebugService | IExpression, IExpression, FuzzyScore>>this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'WatchExpressions', treeContainer, new WatchExpressionsDelegate(),
|
||||
[
|
||||
expressionsRenderer,
|
||||
this.instantiationService.createInstance(VariablesRenderer, linkDetector, watchDisplayType),
|
||||
this.instantiationService.createInstance(VariablesRenderer, linkDetector),
|
||||
this.instantiationService.createInstance(VisualizedVariableRenderer, linkDetector),
|
||||
],
|
||||
this.instantiationService.createInstance(WatchExpressionsDataSource), {
|
||||
|
@ -280,7 +279,6 @@ export class WatchExpressionsRenderer extends AbstractExpressionsRenderer {
|
|||
static readonly ID = 'watchexpression';
|
||||
|
||||
constructor(
|
||||
private watchDisplayType: boolean,
|
||||
@IMenuService private readonly menuService: IMenuService,
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
@IDebugService debugService: IDebugService,
|
||||
|
@ -297,10 +295,8 @@ export class WatchExpressionsRenderer extends AbstractExpressionsRenderer {
|
|||
|
||||
public override renderElement(node: ITreeNode<IExpression, FuzzyScore>, index: number, data: IExpressionTemplateData): void {
|
||||
data.elementDisposable.clear();
|
||||
data.currentElement = node.element;
|
||||
data.elementDisposable.add(this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration('debug.showVariableTypes')) {
|
||||
this.watchDisplayType = this.configurationService.getValue<IDebugConfiguration>('debug').showVariableTypes;
|
||||
super.renderExpressionElement(node.element, node, data);
|
||||
}
|
||||
}));
|
||||
|
@ -310,7 +306,8 @@ export class WatchExpressionsRenderer extends AbstractExpressionsRenderer {
|
|||
protected renderExpression(expression: IExpression, data: IExpressionTemplateData, highlights: IHighlight[]): void {
|
||||
let text: string;
|
||||
data.type.textContent = '';
|
||||
if (this.watchDisplayType && expression.type) {
|
||||
const showType = this.configurationService.getValue<IDebugConfiguration>('debug').showVariableTypes;
|
||||
if (showType && expression.type) {
|
||||
text = typeof expression.value === 'string' ? `${expression.name}: ` : expression.name;
|
||||
//render type
|
||||
data.type.textContent = expression.type + ' =';
|
||||
|
@ -320,7 +317,7 @@ export class WatchExpressionsRenderer extends AbstractExpressionsRenderer {
|
|||
|
||||
let title: string;
|
||||
if (expression.type) {
|
||||
if (this.watchDisplayType) {
|
||||
if (showType) {
|
||||
title = `${expression.name}`;
|
||||
} else {
|
||||
title = expression.type === expression.value ?
|
||||
|
|
|
@ -17,6 +17,8 @@ import { NullHoverService } from 'vs/platform/hover/test/browser/nullHoverServic
|
|||
import { IDebugService, IViewModel } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { VariablesRenderer } from 'vs/workbench/contrib/debug/browser/variablesView';
|
||||
import { LinkDetector } from 'vs/workbench/contrib/debug/browser/linkDetector';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
const $ = dom.$;
|
||||
|
||||
|
@ -80,6 +82,7 @@ suite('Debug - Variable Debug View', () => {
|
|||
let variablesRenderer: VariablesRenderer;
|
||||
let instantiationService: TestInstantiationService;
|
||||
let linkDetector: LinkDetector;
|
||||
let configurationService: TestConfigurationService;
|
||||
|
||||
setup(() => {
|
||||
instantiationService = workbenchInstantiationService(undefined, disposables);
|
||||
|
@ -92,12 +95,24 @@ suite('Debug - Variable Debug View', () => {
|
|||
});
|
||||
|
||||
test('variable expressions with display type', () => {
|
||||
variablesRenderer = instantiationService.createInstance(VariablesRenderer, linkDetector, true);
|
||||
configurationService = new TestConfigurationService({
|
||||
debug: {
|
||||
showVariableTypes: true
|
||||
}
|
||||
});
|
||||
instantiationService.stub(IConfigurationService, configurationService);
|
||||
variablesRenderer = instantiationService.createInstance(VariablesRenderer, linkDetector);
|
||||
assertVariable(disposables, variablesRenderer, true);
|
||||
});
|
||||
|
||||
test('variable expressions', () => {
|
||||
variablesRenderer = instantiationService.createInstance(VariablesRenderer, linkDetector, false);
|
||||
configurationService = new TestConfigurationService({
|
||||
debug: {
|
||||
showVariableTypes: false
|
||||
}
|
||||
});
|
||||
instantiationService.stub(IConfigurationService, configurationService);
|
||||
variablesRenderer = instantiationService.createInstance(VariablesRenderer, linkDetector);
|
||||
assertVariable(disposables, variablesRenderer, false);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,6 +16,8 @@ import { workbenchInstantiationService } from 'vs/workbench/test/browser/workben
|
|||
import { IHoverService } from 'vs/platform/hover/browser/hover';
|
||||
import { NullHoverService } from 'vs/platform/hover/test/browser/nullHoverService';
|
||||
import { IDebugService, IViewModel } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
const $ = dom.$;
|
||||
|
||||
function assertWatchVariable(disposables: Pick<DisposableStore, "add">, watchExpressionsRenderer: WatchExpressionsRenderer, displayType: boolean) {
|
||||
|
@ -77,6 +79,7 @@ suite('Debug - Watch Debug View', () => {
|
|||
const disposables = ensureNoDisposablesAreLeakedInTestSuite();
|
||||
let watchExpressionsRenderer: WatchExpressionsRenderer;
|
||||
let instantiationService: TestInstantiationService;
|
||||
let configurationService: TestConfigurationService;
|
||||
|
||||
setup(() => {
|
||||
instantiationService = workbenchInstantiationService(undefined, disposables);
|
||||
|
@ -85,16 +88,27 @@ suite('Debug - Watch Debug View', () => {
|
|||
debugService.getViewModel = () => <IViewModel>{ focusedStackFrame: undefined, getSelectedExpression: () => undefined };
|
||||
debugService.getViewModel().getSelectedExpression = () => undefined;
|
||||
instantiationService.stub(IDebugService, debugService);
|
||||
|
||||
});
|
||||
|
||||
test('watch expressions with display type', () => {
|
||||
watchExpressionsRenderer = instantiationService.createInstance(WatchExpressionsRenderer, true);
|
||||
configurationService = new TestConfigurationService({
|
||||
debug: {
|
||||
showVariableTypes: true
|
||||
}
|
||||
});
|
||||
instantiationService.stub(IConfigurationService, configurationService);
|
||||
watchExpressionsRenderer = instantiationService.createInstance(WatchExpressionsRenderer);
|
||||
assertWatchVariable(disposables, watchExpressionsRenderer, true);
|
||||
});
|
||||
|
||||
test('watch expressions', () => {
|
||||
watchExpressionsRenderer = instantiationService.createInstance(WatchExpressionsRenderer, false);
|
||||
configurationService = new TestConfigurationService({
|
||||
debug: {
|
||||
showVariableTypes: false
|
||||
}
|
||||
});
|
||||
instantiationService.stub(IConfigurationService, configurationService);
|
||||
watchExpressionsRenderer = instantiationService.createInstance(WatchExpressionsRenderer);
|
||||
assertWatchVariable(disposables, watchExpressionsRenderer, false);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue