Include extension ID in variable item context (#204879)

* remove broken precondition

* include extension ID in context
This commit is contained in:
Aaron Munger 2024-02-10 14:00:35 -08:00 committed by GitHub
parent b2f1748501
commit 2aae82a102
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 11 additions and 7 deletions

View file

@ -1121,6 +1121,7 @@ export interface VariablesResult {
value: string;
hasNamedChildren: boolean;
indexedChildrenCount: number;
extensionId: string;
}
export interface MainThreadNotebookKernelsShape extends IDisposable {

View file

@ -458,7 +458,8 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
value: result.variable.value,
type: result.variable.type,
hasNamedChildren: result.hasNamedChildren,
indexedChildrenCount: result.indexedChildrenCount
indexedChildrenCount: result.indexedChildrenCount,
extensionId: obj.extensionId.value,
};
this.variableStore[variable.id] = result.variable;
this._proxy.$receiveVariable(requestId, variable);

View file

@ -88,6 +88,7 @@ export const CONTEXT_VARIABLE_VALUE = new RawContextKey<boolean>('variableValue'
export const CONTEXT_VARIABLE_TYPE = new RawContextKey<boolean>('variableType', false, { type: 'string', description: nls.localize('variableType', "Type of the variable, present for debug visualization clauses.") });
export const CONTEXT_VARIABLE_NAME = new RawContextKey<boolean>('variableName', false, { type: 'string', description: nls.localize('variableName', "Name of the variable, present for debug visualization clauses.") });
export const CONTEXT_VARIABLE_LANGUAGE = new RawContextKey<boolean>('variableLanguage', false, { type: 'string', description: nls.localize('variableLanguage', "Language of the variable source, present for debug visualization clauses.") });
export const CONTEXT_VARIABLE_EXTENSIONID = new RawContextKey<boolean>('variableExtensionId', false, { type: 'string', description: nls.localize('variableExtensionId', "Extension ID of the variable source, present for debug visualization clauses.") });
export const CONTEXT_EXCEPTION_WIDGET_VISIBLE = new RawContextKey<boolean>('exceptionWidgetVisible', false, { type: 'boolean', description: nls.localize('exceptionWidgetVisible', "True when the exception widget is visible.") });
export const CONTEXT_MULTI_SESSION_REPL = new RawContextKey<boolean>('multiSessionRepl', false, { type: 'boolean', description: nls.localize('multiSessionRepl', "True when there is more than 1 debug console.") });
export const CONTEXT_MULTI_SESSION_DEBUG = new RawContextKey<boolean>('multiSessionDebug', false, { type: 'boolean', description: nls.localize('multiSessionDebug', "True when there is more than 1 active debug session.") });

View file

@ -6,7 +6,6 @@
import { localize } from 'vs/nls';
import { Action2, registerAction2 } from 'vs/platform/actions/common/actions';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { contextMenuArg } from 'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView';
@ -18,7 +17,6 @@ registerAction2(class extends Action2 {
id: COPY_NOTEBOOK_VARIABLE_VALUE_ID,
title: COPY_NOTEBOOK_VARIABLE_VALUE_LABEL,
f1: false,
precondition: ContextKeyExpr.has('value'),
});
}

View file

@ -26,6 +26,7 @@ export interface INotebookVariableElement {
readonly indexStart?: number;
readonly hasNamedChildren: boolean;
readonly notebook: NotebookTextModel;
readonly extensionId?: string;
}
export class NotebookVariableDataSource implements IAsyncDataSource<INotebookScope, INotebookVariableElement> {

View file

@ -25,7 +25,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IViewPaneOptions, ViewPane } from 'vs/workbench/browser/parts/views/viewPane';
import { IViewDescriptorService } from 'vs/workbench/common/views';
import { CONTEXT_VARIABLE_LANGUAGE, CONTEXT_VARIABLE_NAME, CONTEXT_VARIABLE_TYPE, CONTEXT_VARIABLE_VALUE } from 'vs/workbench/contrib/debug/common/debug';
import { CONTEXT_VARIABLE_EXTENSIONID, CONTEXT_VARIABLE_LANGUAGE, CONTEXT_VARIABLE_NAME, CONTEXT_VARIABLE_TYPE, CONTEXT_VARIABLE_VALUE } from 'vs/workbench/contrib/debug/common/debug';
import { INotebookScope, INotebookVariableElement, NotebookVariableDataSource } from 'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource';
import { NotebookVariableAccessibilityProvider, NotebookVariableRenderer, NotebookVariablesDelegate } from 'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree';
import { getNotebookEditorFromEditorPane } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
@ -34,7 +34,7 @@ import { ICellExecutionStateChangedEvent, IExecutionStateChangedEvent, INotebook
import { INotebookKernelService } from 'vs/workbench/contrib/notebook/common/notebookKernelService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
export type contextMenuArg = { source?: string; type?: string; value?: string; language?: string };
export type contextMenuArg = { source?: string; type?: string; value?: string; language?: string; extensionId?: string };
export class NotebookVariablesView extends ViewPane {
@ -110,7 +110,8 @@ export class NotebookVariablesView extends ViewPane {
source: element.notebook.uri.toString(),
value: element.value,
type: element.type,
language: element.language
language: element.language,
extensionId: element.extensionId
};
const actions: IAction[] = [];
@ -118,7 +119,8 @@ export class NotebookVariablesView extends ViewPane {
[CONTEXT_VARIABLE_NAME.key, element.name],
[CONTEXT_VARIABLE_VALUE.key, element.value],
[CONTEXT_VARIABLE_TYPE.key, element.type],
[CONTEXT_VARIABLE_LANGUAGE.key, element.language]
[CONTEXT_VARIABLE_LANGUAGE.key, element.language],
[CONTEXT_VARIABLE_EXTENSIONID.key, element.extensionId]
]);
const menu = this.menuService.createMenu(MenuId.NotebookVariablesContext, overlayedContext);
createAndFillInContextMenuActions(menu, { arg, shouldForwardArgs: true }, actions);