Clear Notebook Editor Cache
This commit is contained in:
parent
4a5d3623c0
commit
90ca212f5f
|
@ -10,6 +10,7 @@ import { CATEGORIES } from 'vs/workbench/common/actions';
|
|||
import { getNotebookEditorFromEditorPane, ICellViewModel, INotebookEditor, INotebookEditorContribution } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { registerNotebookContribution } from 'vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
|
||||
import { NotebookEditorWidget } from 'vs/workbench/contrib/notebook/browser/notebookEditorWidget';
|
||||
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
|
||||
export class TroubleshootController extends Disposable implements INotebookEditorContribution {
|
||||
|
@ -129,3 +130,19 @@ registerAction2(class extends Action2 {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: 'notebook.clearNotebookEdtitorTypeCache',
|
||||
title: 'Clear Notebook Editor Cache',
|
||||
category: CATEGORIES.Developer,
|
||||
f1: true
|
||||
});
|
||||
}
|
||||
|
||||
async run(accessor: ServicesAccessor): Promise<void> {
|
||||
const notebookService = accessor.get(INotebookService);
|
||||
notebookService.clearEditorCache();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -135,6 +135,12 @@ export class NotebookProviderInfoStore extends Disposable {
|
|||
this._memento.saveMemento();
|
||||
}
|
||||
|
||||
clearEditorCache() {
|
||||
const mementoObject = this._memento.getMemento(StorageScope.GLOBAL, StorageTarget.MACHINE);
|
||||
mementoObject[NotebookProviderInfoStore.CUSTOM_EDITORS_ENTRY_ID] = [];
|
||||
this._memento.saveMemento();
|
||||
}
|
||||
|
||||
private _convertPriority(priority?: string) {
|
||||
if (!priority) {
|
||||
return RegisteredEditorPriority.default;
|
||||
|
@ -523,6 +529,10 @@ export class NotebookService extends Disposable implements INotebookService {
|
|||
}));
|
||||
}
|
||||
|
||||
clearEditorCache(): void {
|
||||
this.notebookProviderInfoStore.clearEditorCache();
|
||||
}
|
||||
|
||||
private _postDocumentOpenActivation(viewType: string) {
|
||||
// send out activations on notebook text model creation
|
||||
this._extensionService.activateByEvent(`onNotebook:${viewType}`);
|
||||
|
|
|
@ -92,4 +92,5 @@ export interface INotebookService {
|
|||
|
||||
setToCopy(items: NotebookCellTextModel[], isCopy: boolean): void;
|
||||
getToCopy(): { items: NotebookCellTextModel[], isCopy: boolean; } | undefined;
|
||||
clearEditorCache(): void;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue