提交 128e9b50 编写于 作者: A Andre Weinand

add frameId to InlineValueContext

上级 cb7ad05c
......@@ -297,11 +297,11 @@ export interface EvaluatableExpressionProvider {
}
/**
* An open ended information bag passed to the inline value provider.
* A minimal context containes just the document location where the debugger has stopped.
* A value-object that contains contextual information when requesting inline values from a InlineValuesProvider.
* @internal
*/
export interface InlineValueContext {
frameId: number;
stoppedLocation: Range;
}
......
......@@ -695,18 +695,20 @@ declare module 'vscode' {
}
/**
* A value-object that contains additional information when requesting inline values from a InlineValuesProvider.
* A minimal context containes just the document location where the debugger has stopped.
* Additional optional information might be scope information or variables and their values.
* A value-object that contains contextual information when requesting inline values from a InlineValuesProvider.
*/
export interface InlineValueContext {
/**
* Debug Adapter Protocol ID of the the stack frame.
*/
readonly frameId: number;
/**
* The document range where execution has stopped.
* Typically the end position of the range denotes the line where the inline values are shown.
*/
stoppedLocation: Range;
// ... more to come, e.g. Scope information or variable/value candidate information
readonly stoppedLocation: Range;
}
/**
......
......@@ -1474,6 +1474,7 @@ export interface ILinkedEditingRangesDto {
}
export interface IInlineValueContextDto {
frameId: number;
stoppedLocation: IRange;
}
......
......@@ -901,12 +901,13 @@ export namespace InlineValue {
export namespace InlineValueContext {
export function from(inlineValueContext: vscode.InlineValueContext): extHostProtocol.IInlineValueContextDto {
return <extHostProtocol.IInlineValueContextDto>{
frameId: inlineValueContext.frameId,
stoppedLocation: Range.from(inlineValueContext.stoppedLocation)
};
}
export function to(inlineValueContext: extHostProtocol.IInlineValueContextDto): types.InlineValueContext {
return new types.InlineValueContext(Range.to(inlineValueContext.stoppedLocation));
return new types.InlineValueContext(inlineValueContext.frameId, Range.to(inlineValueContext.stoppedLocation));
}
}
......
......@@ -2476,9 +2476,11 @@ export class InlineValueEvaluatableExpression implements vscode.InlineValueEvalu
@es5ClassCompat
export class InlineValueContext implements vscode.InlineValueContext {
readonly frameId: number;
readonly stoppedLocation: vscode.Range;
constructor(range: vscode.Range) {
constructor(frameId: number, range: vscode.Range) {
this.frameId = frameId;
this.stoppedLocation = range;
}
}
......
......@@ -12,7 +12,7 @@ import { setProperty } from 'vs/base/common/jsonEdit';
import { Constants } from 'vs/base/common/uint';
import { KeyCode } from 'vs/base/common/keyCodes';
import { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { InlineValuesProviderRegistry, StandardTokenType } from 'vs/editor/common/modes';
import { InlineValueContext, InlineValuesProviderRegistry, StandardTokenType } from 'vs/editor/common/modes';
import { CancellationTokenSource } from 'vs/base/common/cancellation';
import { flatten } from 'vs/base/common/arrays';
import { onUnexpectedExternalError } from 'vs/base/common/errors';
......@@ -603,15 +603,16 @@ export class DebugEditorContribution implements IDebugEditorContribution {
return undefined;
};
const ranges = this.editor.getVisibleRangesPlusViewportAboveBelow();
const ctx = { stoppedLocation: new Range(stackFrame.range.startLineNumber, stackFrame.range.startColumn + 1, stackFrame.range.endLineNumber, stackFrame.range.endColumn + 1) };
const ctx: InlineValueContext = {
frameId: stackFrame.frameId,
stoppedLocation: new Range(stackFrame.range.startLineNumber, stackFrame.range.startColumn + 1, stackFrame.range.endLineNumber, stackFrame.range.endColumn + 1)
};
const token = new CancellationTokenSource().token;
const ranges = this.editor.getVisibleRangesPlusViewportAboveBelow();
const providers = InlineValuesProviderRegistry.ordered(model).reverse();
allDecorations = [];
const lineDecorations = new Map<number, InlineSegment[]>();
const promises = flatten(providers.map(provider => ranges.map(range => Promise.resolve(provider.provideInlineValues(model, range, ctx, token)).then(async (result) => {
......@@ -641,9 +642,8 @@ export class DebugEditorContribution implements IDebugEditorContribution {
expr = lineContent.substring(iv.range.startColumn - 1, iv.range.endColumn - 1);
}
if (expr) {
const viewModel = this.debugService.getViewModel();
const expression = new Expression(expr);
await expression.evaluate(viewModel.focusedSession, viewModel.focusedStackFrame, 'watch');
await expression.evaluate(stackFrame.thread.session, stackFrame, 'watch');
if (expression.available) {
text = strings.format(var_value_format, expr, expression.value);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册