Hide notebook toolbar icons in diff editor (#17303)

* hide notebook toolbar icons in diff editor

* move showActions to notebookInput

* make showActions readonly
This commit is contained in:
Lucy Zhang
2021-10-15 05:19:14 -07:00
committed by GitHub
parent 58d5f317d3
commit e315115f00
8 changed files with 38 additions and 21 deletions

View File

@@ -24,8 +24,8 @@ export class DiffNotebookInput extends SideBySideEditorInput {
@INotebookService notebookService: INotebookService,
@ILogService logService: ILogService
) {
let originalInput = instantiationService.createInstance(FileNotebookInput, diffInput.primary.getName(), diffInput.primary.resource, diffInput.originalInput as FileEditorInput);
let modifiedInput = instantiationService.createInstance(FileNotebookInput, diffInput.secondary.getName(), diffInput.secondary.resource, diffInput.modifiedInput as FileEditorInput);
let originalInput = instantiationService.createInstance(FileNotebookInput, diffInput.primary.getName(), diffInput.primary.resource, diffInput.originalInput as FileEditorInput, false);
let modifiedInput = instantiationService.createInstance(FileNotebookInput, diffInput.secondary.getName(), diffInput.secondary.resource, diffInput.modifiedInput as FileEditorInput, false);
super(title, diffInput.getTitle(), modifiedInput, originalInput);
this._notebookService = notebookService;
this._logService = logService;

View File

@@ -18,12 +18,13 @@ export class FileNotebookInput extends NotebookInput {
title: string,
resource: URI,
textInput: FileEditorInput,
showActions: boolean,
@ITextModelService textModelService: ITextModelService,
@IInstantiationService instantiationService: IInstantiationService,
@INotebookService notebookService: INotebookService,
@IExtensionService extensionService: IExtensionService
) {
super(title, resource, textInput, textModelService, instantiationService, notebookService, extensionService);
super(title, resource, textInput, showActions, textModelService, instantiationService, notebookService, extensionService);
}
public override get textInput(): FileEditorInput {

View File

@@ -237,6 +237,7 @@ export abstract class NotebookInput extends EditorInput implements INotebookInpu
constructor(private _title: string,
private _resource: URI,
private _textInput: TextInput,
private _showActions: boolean,
@ITextModelService private textModelService: ITextModelService,
@IInstantiationService private instantiationService: IInstantiationService,
@INotebookService private notebookService: INotebookService,
@@ -515,6 +516,10 @@ export abstract class NotebookInput extends EditorInput implements INotebookInpu
return this.textInput.matches(otherInput);
}
}
public get showActions(): boolean {
return this._showActions;
}
}
export class NotebookEditorContentLoader implements IContentLoader {

View File

@@ -31,7 +31,7 @@ export class NotebookEditorInputAssociation implements ILanguageAssociation {
convertInput(activeEditor: IEditorInput): NotebookInput | DiffNotebookInput | undefined {
if (activeEditor instanceof FileEditorInput) {
return this.instantiationService.createInstance(FileNotebookInput, activeEditor.getName(), activeEditor.resource, activeEditor);
return this.instantiationService.createInstance(FileNotebookInput, activeEditor.getName(), activeEditor.resource, activeEditor, true);
} else if (activeEditor instanceof UntitledTextEditorInput) {
return this.instantiationService.createInstance(UntitledNotebookInput, activeEditor.getName(), activeEditor.resource, activeEditor);
} else if (activeEditor instanceof DiffEditorInput) {
@@ -65,7 +65,7 @@ export class FileNoteBookEditorInputSerializer implements IEditorInputSerializer
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): FileNotebookInput | undefined {
const factory = editorInputFactoryRegistry.getEditorInputSerializer(FILE_EDITOR_INPUT_ID);
const fileEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as FileEditorInput;
return instantiationService.createInstance(FileNotebookInput, fileEditorInput.getName(), fileEditorInput.resource, fileEditorInput);
return instantiationService.createInstance(FileNotebookInput, fileEditorInput.getName(), fileEditorInput.resource, fileEditorInput, true);
}
canSerialize(): boolean { // we can always serialize notebooks

View File

@@ -25,7 +25,7 @@ export class UntitledNotebookInput extends NotebookInput {
@INotebookService notebookService: INotebookService,
@IExtensionService extensionService: IExtensionService
) {
super(title, resource, textInput, textModelService, instantiationService, notebookService, extensionService);
super(title, resource, textInput, true, textModelService, instantiationService, notebookService, extensionService);
}
public override get textInput(): UntitledTextEditorInput {