From 8aeb33c98c52b055ec1b60f4ed1da1fa450ec24c Mon Sep 17 00:00:00 2001 From: Kevin Cunnane Date: Fri, 7 Dec 2018 12:14:26 -0800 Subject: [PATCH] Fix #3470 Notebook: Switching between Servers and File Explorer opens a duplicate notebook (#3500) - We missed implementing matches functionality. This is required in order to skip reopening of the notebook --- src/sql/parts/notebook/notebookInput.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/sql/parts/notebook/notebookInput.ts b/src/sql/parts/notebook/notebookInput.ts index 991ec861ed..fff390bd6d 100644 --- a/src/sql/parts/notebook/notebookInput.ts +++ b/src/sql/parts/notebook/notebookInput.ts @@ -177,4 +177,20 @@ export class NotebookInput extends EditorInput { setDirty(isDirty: boolean): void { this._model.setDirty(isDirty); } + + + public matches(otherInput: any): boolean { + if (super.matches(otherInput) === true) { + return true; + } + + if (otherInput instanceof NotebookInput) { + const otherNotebookEditorInput = otherInput; + + // Compare by resource + return otherNotebookEditorInput.notebookUri.toString() === this.notebookUri.toString(); + } + + return false; + } } \ No newline at end of file