Skip to content

Commit

Permalink
Merge pull request #206779 from microsoft/joh/fix/206487
Browse files Browse the repository at this point in the history
use document object identity and not uri equality when checking if a document belongs to a notebook
  • Loading branch information
jrieken authored Mar 5, 2024
2 parents 0727ad7 + 0fc763a commit 1e790d7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const interalSelector = typeConverters.LanguageSelector.from(selector);
let notebook: vscode.NotebookDocument | undefined;
if (targetsNotebooks(interalSelector)) {
notebook = extHostNotebook.notebookDocuments.find(value => Boolean(value.getCell(document.uri)))?.apiNotebook;
notebook = extHostNotebook.notebookDocuments.find(value => value.apiNotebook.getCells().find(c => c.document === document))?.apiNotebook;
}
return score(interalSelector, document.uri, document.languageId, true, notebook?.uri, notebook?.notebookType);
},
Expand Down
12 changes: 1 addition & 11 deletions src/vs/workbench/api/common/extHostNotebookDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,17 +442,7 @@ export class ExtHostNotebookDocument {
return this._cells[index];
}

getCell(cellHandle: number | URI): ExtHostCell | undefined {
if (URI.isUri(cellHandle)) {
const data = notebookCommon.CellUri.parse(cellHandle);
if (!data) {
return undefined;
}
if (data.notebook.toString() !== this.uri.toString()) {
return undefined;
}
cellHandle = data.handle;
}
getCell(cellHandle: number): ExtHostCell | undefined {
return this._cells.find(cell => cell.handle === cellHandle);
}

Expand Down

0 comments on commit 1e790d7

Please sign in to comment.