-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add goto variables button * more appropriate icon
- Loading branch information
Showing
7 changed files
with
84 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/vs/workbench/contrib/notebook/browser/controller/variablesActions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { localize2 } from '../../../../../nls.js'; | ||
import { MenuId, registerAction2 } from '../../../../../platform/actions/common/actions.js'; | ||
import { ContextKeyExpr } from '../../../../../platform/contextkey/common/contextkey.js'; | ||
import { ServicesAccessor } from '../../../../../platform/instantiation/common/instantiation.js'; | ||
import { IViewsService } from '../../../../services/views/common/viewsService.js'; | ||
import { KERNEL_HAS_VARIABLE_PROVIDER } from '../../common/notebookContextKeys.js'; | ||
import { NOTEBOOK_VARIABLE_VIEW_ENABLED } from '../contrib/notebookVariables/notebookVariableContextKeys.js'; | ||
import * as icons from '../notebookIcons.js'; | ||
|
||
import { INotebookActionContext, NotebookAction } from './coreActions.js'; | ||
|
||
const OPEN_VARIABLES_VIEW_COMMAND_ID = 'notebook.openVariablesView'; | ||
|
||
registerAction2(class OpenVariablesViewAction extends NotebookAction { | ||
|
||
constructor() { | ||
super({ | ||
id: OPEN_VARIABLES_VIEW_COMMAND_ID, | ||
title: localize2('notebookActions.openVariablesView', "Variables"), | ||
icon: icons.variablesViewIcon, | ||
menu: [ | ||
{ | ||
id: MenuId.InteractiveToolbar, | ||
group: 'navigation', | ||
when: ContextKeyExpr.and( | ||
KERNEL_HAS_VARIABLE_PROVIDER, | ||
// jupyter extension currently contributes their own goto variables button | ||
ContextKeyExpr.notEquals('jupyter.kernel.isjupyter', true), | ||
NOTEBOOK_VARIABLE_VIEW_ENABLED | ||
) | ||
}, | ||
{ | ||
id: MenuId.EditorTitle, | ||
order: -1, | ||
group: 'navigation', | ||
when: ContextKeyExpr.and( | ||
KERNEL_HAS_VARIABLE_PROVIDER, | ||
// jupyter extension currently contributes their own goto variables button | ||
ContextKeyExpr.notEquals('jupyter.kernel.isjupyter', true), | ||
ContextKeyExpr.notEquals('config.notebook.globalToolbar', true), | ||
NOTEBOOK_VARIABLE_VIEW_ENABLED | ||
) | ||
}, | ||
{ | ||
id: MenuId.NotebookToolbar, | ||
order: -1, | ||
group: 'navigation', | ||
when: ContextKeyExpr.and( | ||
KERNEL_HAS_VARIABLE_PROVIDER, | ||
// jupyter extension currently contributes their own goto variables button | ||
ContextKeyExpr.notEquals('jupyter.kernel.isjupyter', true), | ||
ContextKeyExpr.equals('config.notebook.globalToolbar', true), | ||
NOTEBOOK_VARIABLE_VIEW_ENABLED | ||
) | ||
} | ||
] | ||
}); | ||
} | ||
|
||
override async runWithContext(accessor: ServicesAccessor, context: INotebookActionContext) { | ||
const variableViewId = 'workbench.notebook.variables'; | ||
accessor.get(IViewsService).openView(variableViewId, true); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters