Skip to content

Better handling of notebook diagnostics - #16529

Merged
Don Jayamanne (DonJayamanne) merged 3 commits into
mainfrom
issue6130
Jun 21, 2021
Merged

Don Jayamanne (DonJayamanne) merged 3 commits into
mainfrom
issue6130

Conversation

@DonJayamanne

@DonJayamanne Don Jayamanne (DonJayamanne) commented Jun 21, 2021 •

Copy link
Copy Markdown

Fixes some long standing issues in microsoft/vscode-jupyter#5161


private onDidChangeCellsEmitter = new EventEmitter<TextDocumentChangeEvent>();

private mapOfConcatDocumentsWithCellUris = new Map<string, string[]>();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storing the Uris as strings (don't want to be storing the objects)

const currentCellUris = new Set(cellUris);
oldCellUris
.filter((cellUri) => !currentCellUris.has(cellUri))
.forEach((cellUri) => result.set(Uri.parse(cellUri), []));

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, if we delete a cell, the diagnostics of deleted cells remains & doesn't go away.

} else if (this.mapOfConcatDocumentsWithCellUris.has(uri.toString())) {
(this.mapOfConcatDocumentsWithCellUris.get(uri.toString()) || [])
.map((cellUri) => Uri.parse(cellUri))
.forEach((cellUri) => result.set(cellUri, []));

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, if a notebook is closed, the diagnostics don't go away.
This is because when a notebook is closed, the wrapper is disposed and we don't have the wrapper document, hence we cannot get the cells to clear the diagnostics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip tests Updates to tests unnecessary

4 participants