mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 00:59:03 +01:00
make getEditorById strict
This commit is contained in:
@@ -106,20 +106,14 @@ export class ExtHostNotebookController implements ExtHostNotebookShape {
|
||||
});
|
||||
}
|
||||
|
||||
getEditorById(editorId: string, strict: true): ExtHostNotebookEditor;
|
||||
getEditorById(editorId: string): ExtHostNotebookEditor | undefined;
|
||||
getEditorById(editorId: string, strict?: true): ExtHostNotebookEditor | undefined {
|
||||
getEditorById(editorId: string): ExtHostNotebookEditor {
|
||||
const editor = this._editors.get(editorId);
|
||||
if (!editor && strict) {
|
||||
if (!editor) {
|
||||
throw new Error(`unknown text editor: ${editorId}. known editors: ${[...this._editors.keys()]} `);
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
|
||||
allEditors(): ExtHostNotebookEditor[] {
|
||||
return [...this._editors.values()];
|
||||
}
|
||||
|
||||
getIdByEditor(editor: vscode.NotebookEditor): string | undefined {
|
||||
for (const [id, candidate] of this._editors) {
|
||||
if (candidate.apiEditor === editor) {
|
||||
|
||||
Reference in New Issue
Block a user