diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index 8f07046449c..75c3b055ca7 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -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; } diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index d66dd7a0bb7..aeef9e660ec 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -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; } /** diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 29b6e677e1a..12934c8f44a 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1474,6 +1474,7 @@ export interface ILinkedEditingRangesDto { } export interface IInlineValueContextDto { + frameId: number; stoppedLocation: IRange; } diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index f93372ba708..8107afff73e 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -901,12 +901,13 @@ export namespace InlineValue { export namespace InlineValueContext { export function from(inlineValueContext: vscode.InlineValueContext): extHostProtocol.IInlineValueContextDto { return { + 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)); } } diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index 81a8415df14..5c77b3385b8 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -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; } } diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts index eee02b6b8ad..abc99125a96 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts @@ -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(); 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); }