Skip to content

Commit 1e790d7

Browse files
authored
Merge pull request #206779 from microsoft/joh/fix/206487
use document object identity and not uri equality when checking if a document belongs to a notebook
2 parents 0727ad7 + 0fc763a commit 1e790d7

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/vs/workbench/api/common/extHost.api.impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
536536
const interalSelector = typeConverters.LanguageSelector.from(selector);
537537
let notebook: vscode.NotebookDocument | undefined;
538538
if (targetsNotebooks(interalSelector)) {
539-
notebook = extHostNotebook.notebookDocuments.find(value => Boolean(value.getCell(document.uri)))?.apiNotebook;
539+
notebook = extHostNotebook.notebookDocuments.find(value => value.apiNotebook.getCells().find(c => c.document === document))?.apiNotebook;
540540
}
541541
return score(interalSelector, document.uri, document.languageId, true, notebook?.uri, notebook?.notebookType);
542542
},

src/vs/workbench/api/common/extHostNotebookDocument.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -442,17 +442,7 @@ export class ExtHostNotebookDocument {
442442
return this._cells[index];
443443
}
444444

445-
getCell(cellHandle: number | URI): ExtHostCell | undefined {
446-
if (URI.isUri(cellHandle)) {
447-
const data = notebookCommon.CellUri.parse(cellHandle);
448-
if (!data) {
449-
return undefined;
450-
}
451-
if (data.notebook.toString() !== this.uri.toString()) {
452-
return undefined;
453-
}
454-
cellHandle = data.handle;
455-
}
445+
getCell(cellHandle: number): ExtHostCell | undefined {
456446
return this._cells.find(cell => cell.handle === cellHandle);
457447
}
458448

0 commit comments

Comments
 (0)