fix #115011.
This commit is contained in:
parent
c3746fa0ae
commit
d5bdb0efb2
|
@ -1292,6 +1292,11 @@
|
|||
"group": "navigation",
|
||||
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"
|
||||
},
|
||||
{
|
||||
"command": "git.openFile",
|
||||
"group": "navigation",
|
||||
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInNotebookTextDiffEditor && resourceScheme =~ /^git$|^file$/"
|
||||
},
|
||||
{
|
||||
"command": "git.openChange",
|
||||
"group": "navigation",
|
||||
|
|
|
@ -46,9 +46,6 @@ import { NotebookDiffEditorEventDispatcher, NotebookDiffLayoutChangedEvent } fro
|
|||
|
||||
const $ = DOM.$;
|
||||
|
||||
export const IN_NOTEBOOK_TEXT_DIFF_EDITOR = new RawContextKey<boolean>('isInNotebookTextDiffEditor', false);
|
||||
|
||||
|
||||
export class NotebookTextDiffEditor extends EditorPane implements INotebookTextDiffEditor {
|
||||
static readonly ID: string = 'workbench.editor.notebookTextDiffEditor';
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import { IEditorService, IOpenEditorOverride } from 'vs/workbench/services/edito
|
|||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { CustomEditorsAssociations, customEditorsAssociationsSettingId } from 'vs/workbench/services/editor/common/editorOpenWith';
|
||||
import { CustomEditorInfo } from 'vs/workbench/contrib/customEditor/common/customEditor';
|
||||
import { INotebookEditor, NotebookEditorOptions, NOTEBOOK_EDITOR_OPEN } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { INotebookEditor, IN_NOTEBOOK_TEXT_DIFF_EDITOR, NotebookEditorOptions, NOTEBOOK_EDITOR_OPEN } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
|
||||
import { INotebookEditorModelResolverService, NotebookModelResolverService } from 'vs/workbench/contrib/notebook/common/notebookEditorModelResolverService';
|
||||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
|
@ -208,6 +208,7 @@ Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactor
|
|||
|
||||
export class NotebookContribution extends Disposable implements IWorkbenchContribution {
|
||||
private _notebookEditorIsOpen: IContextKey<boolean>;
|
||||
private _notebookDiffEditorIsOpen: IContextKey<boolean>;
|
||||
|
||||
constructor(
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
|
@ -222,6 +223,7 @@ export class NotebookContribution extends Disposable implements IWorkbenchContri
|
|||
super();
|
||||
|
||||
this._notebookEditorIsOpen = NOTEBOOK_EDITOR_OPEN.bindTo(this.contextKeyService);
|
||||
this._notebookDiffEditorIsOpen = IN_NOTEBOOK_TEXT_DIFF_EDITOR.bindTo(this.contextKeyService);
|
||||
|
||||
this._register(undoRedoService.registerUriComparisonKeyComputer(CellUri.scheme, {
|
||||
getComparisonKey: (uri: URI): string => {
|
||||
|
@ -300,6 +302,7 @@ export class NotebookContribution extends Disposable implements IWorkbenchContri
|
|||
private _updateContextKeys() {
|
||||
const activeEditorPane = this.editorService.activeEditorPane as { isNotebookEditor?: boolean } | undefined;
|
||||
this._notebookEditorIsOpen.set(!!activeEditorPane?.isNotebookEditor);
|
||||
this._notebookDiffEditorIsOpen.set(this.editorService.activeEditorPane?.getId() === 'workbench.editor.notebookTextDiffEditor');
|
||||
}
|
||||
|
||||
getUserAssociatedEditors(resource: URI) {
|
||||
|
|
|
@ -47,6 +47,9 @@ export const NOTEBOOK_EDITOR_EDITABLE = new RawContextKey<boolean>('notebookEdit
|
|||
export const NOTEBOOK_EDITOR_RUNNABLE = new RawContextKey<boolean>('notebookRunnable', true);
|
||||
export const NOTEBOOK_EDITOR_EXECUTING_NOTEBOOK = new RawContextKey<boolean>('notebookExecuting', false);
|
||||
|
||||
// Diff Editor Keys
|
||||
export const IN_NOTEBOOK_TEXT_DIFF_EDITOR = new RawContextKey<boolean>('isInNotebookTextDiffEditor', false);
|
||||
|
||||
// Cell keys
|
||||
export const NOTEBOOK_VIEW_TYPE = new RawContextKey<string>('notebookViewType', undefined);
|
||||
export const NOTEBOOK_CELL_TYPE = new RawContextKey<string>('notebookCellType', undefined); // code, markdown
|
||||
|
|
Loading…
Reference in a new issue