mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -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 { ExtHostNotebookDocumentData } from 'sql/workbench/api/common/extHostNotebookDocumentData';
|
||||||
import { ExtHostNotebookEditor } from 'sql/workbench/api/common/extHostNotebookEditor';
|
import { ExtHostNotebookEditor } from 'sql/workbench/api/common/extHostNotebookEditor';
|
||||||
import { VSCodeNotebookDocument } from 'sql/workbench/api/common/notebooks/vscodeNotebookDocument';
|
import { VSCodeNotebookDocument } from 'sql/workbench/api/common/notebooks/vscodeNotebookDocument';
|
||||||
|
import { VSCodeNotebookEditor } from 'sql/workbench/api/common/notebooks/vscodeNotebookEditor';
|
||||||
|
|
||||||
type Adapter = azdata.nb.NavigationProvider;
|
type Adapter = azdata.nb.NavigationProvider;
|
||||||
|
|
||||||
@@ -49,8 +50,12 @@ export class ExtHostNotebookDocumentsAndEditors implements ExtHostNotebookDocume
|
|||||||
readonly onDidCloseNotebookDocument: Event<azdata.nb.NotebookDocument> = this._onDidCloseNotebook.event;
|
readonly onDidCloseNotebookDocument: Event<azdata.nb.NotebookDocument> = this._onDidCloseNotebook.event;
|
||||||
readonly onDidChangeNotebookCell: Event<azdata.nb.NotebookCellChangeEvent> = this._onDidChangeNotebookCell.event;
|
readonly onDidChangeNotebookCell: Event<azdata.nb.NotebookCellChangeEvent> = this._onDidChangeNotebookCell.event;
|
||||||
|
|
||||||
private _onDidOpenVSCodeNotebook = new Emitter<vscode.NotebookDocument>();
|
private readonly _onDidChangeVisibleVSCodeEditors = new Emitter<vscode.NotebookEditor[]>();
|
||||||
private _onDidCloseVSCodeNotebook = new Emitter<vscode.NotebookDocument>();
|
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 onDidOpenVSCodeNotebookDocument: Event<vscode.NotebookDocument> = this._onDidOpenVSCodeNotebook.event;
|
||||||
readonly onDidCloseVSCodeNotebookDocument: Event<vscode.NotebookDocument> = this._onDidCloseVSCodeNotebook.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._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.onDidOpenNotebookDocument(notebook => this._onDidOpenVSCodeNotebook.fire(new VSCodeNotebookDocument(notebook)));
|
||||||
this.onDidCloseNotebookDocument(notebook => this._onDidCloseVSCodeNotebook.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());
|
return new VSCodeNotebookEditor(extHostNotebookDocumentsAndEditors.getActiveEditor());
|
||||||
},
|
},
|
||||||
onDidChangeActiveNotebookEditor(listener, thisArgs?, disposables?) {
|
onDidChangeActiveNotebookEditor(listener, thisArgs?, disposables?) {
|
||||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||||
throw new Error(functionalityNotSupportedError);
|
return extHostNotebookDocumentsAndEditors.onDidChangeActiveVSCodeEditor(listener, thisArgs, disposables);
|
||||||
// checkProposedApiEnabled(extension);
|
|
||||||
// return extHostNotebook.onDidChangeActiveNotebookEditor(listener, thisArgs, disposables);
|
|
||||||
},
|
},
|
||||||
get visibleNotebookEditors() {
|
get visibleNotebookEditors() {
|
||||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||||
return undefined;
|
return extHostNotebookDocumentsAndEditors.getAllEditors().map(editor => new VSCodeNotebookEditor(editor));
|
||||||
// checkProposedApiEnabled(extension);
|
|
||||||
// return extHostNotebook.visibleNotebookEditors;
|
|
||||||
},
|
},
|
||||||
get onDidChangeVisibleNotebookEditors() {
|
get onDidChangeVisibleNotebookEditors() {
|
||||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||||
return undefined;
|
return extHostNotebookDocumentsAndEditors.onDidChangeVisibleVSCodeEditors;
|
||||||
// checkProposedApiEnabled(extension);
|
|
||||||
// return extHostNotebook.onDidChangeVisibleNotebookEditors;
|
|
||||||
},
|
},
|
||||||
onDidChangeNotebookEditorSelection(listener, thisArgs?, disposables?) {
|
onDidChangeNotebookEditorSelection(listener, thisArgs?, disposables?) {
|
||||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||||
|
|||||||
Reference in New Issue
Block a user