mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 01:25:38 -05:00
Enable VS Code extension event APIs for when editors become active or visible. (#18129)
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
||||
import { ExtHostNotebookDocumentData } from 'sql/workbench/api/common/extHostNotebookDocumentData';
|
||||
import { ExtHostNotebookEditor } from 'sql/workbench/api/common/extHostNotebookEditor';
|
||||
import { VSCodeNotebookDocument } from 'sql/workbench/api/common/notebooks/vscodeNotebookDocument';
|
||||
import { VSCodeNotebookEditor } from 'sql/workbench/api/common/notebooks/vscodeNotebookEditor';
|
||||
|
||||
type Adapter = azdata.nb.NavigationProvider;
|
||||
|
||||
@@ -49,8 +50,12 @@ export class ExtHostNotebookDocumentsAndEditors implements ExtHostNotebookDocume
|
||||
readonly onDidCloseNotebookDocument: Event<azdata.nb.NotebookDocument> = this._onDidCloseNotebook.event;
|
||||
readonly onDidChangeNotebookCell: Event<azdata.nb.NotebookCellChangeEvent> = this._onDidChangeNotebookCell.event;
|
||||
|
||||
private _onDidOpenVSCodeNotebook = new Emitter<vscode.NotebookDocument>();
|
||||
private _onDidCloseVSCodeNotebook = new Emitter<vscode.NotebookDocument>();
|
||||
private readonly _onDidChangeVisibleVSCodeEditors = new Emitter<vscode.NotebookEditor[]>();
|
||||
private readonly _onDidChangeActiveVSCodeEditor = new Emitter<vscode.NotebookEditor>();
|
||||
private readonly _onDidOpenVSCodeNotebook = new Emitter<vscode.NotebookDocument>();
|
||||
private readonly _onDidCloseVSCodeNotebook = new Emitter<vscode.NotebookDocument>();
|
||||
readonly onDidChangeVisibleVSCodeEditors: Event<vscode.NotebookEditor[]> = this._onDidChangeVisibleVSCodeEditors.event;
|
||||
readonly onDidChangeActiveVSCodeEditor: Event<vscode.NotebookEditor> = this._onDidChangeActiveVSCodeEditor.event;
|
||||
readonly onDidOpenVSCodeNotebookDocument: Event<vscode.NotebookDocument> = this._onDidOpenVSCodeNotebook.event;
|
||||
readonly onDidCloseVSCodeNotebookDocument: Event<vscode.NotebookDocument> = this._onDidCloseVSCodeNotebook.event;
|
||||
|
||||
@@ -61,6 +66,8 @@ export class ExtHostNotebookDocumentsAndEditors implements ExtHostNotebookDocume
|
||||
this._proxy = this._mainContext.getProxy(SqlMainContext.MainThreadNotebookDocumentsAndEditors);
|
||||
}
|
||||
|
||||
this.onDidChangeVisibleNotebookEditors(editors => this._onDidChangeVisibleVSCodeEditors.fire(editors.map(editor => new VSCodeNotebookEditor(editor))));
|
||||
this.onDidChangeActiveNotebookEditor(editor => this._onDidChangeActiveVSCodeEditor.fire(new VSCodeNotebookEditor(editor)));
|
||||
this.onDidOpenNotebookDocument(notebook => this._onDidOpenVSCodeNotebook.fire(new VSCodeNotebookDocument(notebook)));
|
||||
this.onDidCloseNotebookDocument(notebook => this._onDidCloseVSCodeNotebook.fire(new VSCodeNotebookDocument(notebook)));
|
||||
}
|
||||
|
||||
@@ -724,22 +724,16 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor, ex
|
||||
return new VSCodeNotebookEditor(extHostNotebookDocumentsAndEditors.getActiveEditor());
|
||||
},
|
||||
onDidChangeActiveNotebookEditor(listener, thisArgs?, disposables?) {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
throw new Error(functionalityNotSupportedError);
|
||||
// checkProposedApiEnabled(extension);
|
||||
// return extHostNotebook.onDidChangeActiveNotebookEditor(listener, thisArgs, disposables);
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
return extHostNotebookDocumentsAndEditors.onDidChangeActiveVSCodeEditor(listener, thisArgs, disposables);
|
||||
},
|
||||
get visibleNotebookEditors() {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
return undefined;
|
||||
// checkProposedApiEnabled(extension);
|
||||
// return extHostNotebook.visibleNotebookEditors;
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
return extHostNotebookDocumentsAndEditors.getAllEditors().map(editor => new VSCodeNotebookEditor(editor));
|
||||
},
|
||||
get onDidChangeVisibleNotebookEditors() {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
return undefined;
|
||||
// checkProposedApiEnabled(extension);
|
||||
// return extHostNotebook.onDidChangeVisibleNotebookEditors;
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
return extHostNotebookDocumentsAndEditors.onDidChangeVisibleVSCodeEditors;
|
||||
},
|
||||
onDidChangeNotebookEditorSelection(listener, thisArgs?, disposables?) {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
|
||||
Reference in New Issue
Block a user