Skip to content

Conversation

@colombod
Copy link
Member

@colombod colombod commented Mar 2, 2023

No description provided.

@colombod colombod requested a review from brettfo March 2, 2023 21:45
@colombod colombod linked an issue Mar 2, 2023 that may be closed by this pull request
17 tasks
@colombod colombod requested a review from jonsequitur March 2, 2023 21:49
return object !== null && typeof object === 'object';
}
const objectKeys1 = Object.keys(object1);
const objectKeys2 = Object.keys(object2);
Copy link
Contributor

Choose a reason for hiding this comment

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

very minor nitpick: object1Keys and object2Keys may read slightly better

Copy link
Member Author

Choose a reason for hiding this comment

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

good point

const notebook = vscode.workspace.notebookDocuments.find(d => d.uri === notebookUri);
if (notebook) {
const metadata = notebook.metadata;
const shouldUpdate = compare(metadata, documentMetadata);
Copy link
Contributor

Choose a reason for hiding this comment

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

I was wondering why we need to update when the metadata has not changed i.e. when compare returns true. Could you please describe what the fix is doing here (just for my own understanding :))?

Copy link
Member Author

Choose a reason for hiding this comment

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

changed that code

return succeeded;
}

export async function replaceNotebookMetadata(notebookUri: vscode.Uri, documentMetadata: { [key: string]: any }): Promise<boolean> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have tests for this method? This was a pretty annoying bug and a significant code change.

If not, it might be a good conversation about how we can test things like this.

Copy link
Member Author

Choose a reason for hiding this comment

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

no it needs to be refactored to be testable

Copy link
Contributor

Choose a reason for hiding this comment

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

You know I love to refactor!

@colombod colombod force-pushed the notebookmodified branch 2 times, most recently from 026ec04 to 319871b Compare March 6, 2023 20:53
"frontend"
],
"languageName": null,
"name": "vscode"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be in the list?

Copy link
Member Author

Choose a reason for hiding this comment

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

it is one of the kernel present

Copy link
Member Author

Choose a reason for hiding this comment

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

filtering out kernels not implementing submitcode

rework comparing and have tests


notebooks


notebooks


notebooks


notebooks


notebooks


notebook


notebooks


fix for ipynb


notebooks


notebooks


notebooks


notebooks


wip


sort objects when merging metadata


handle documentKernelInfo at sorting too


sorted


sort and merge metadata


rewrite  object


notebook


notebooks


notebooks


notebook


fix compiler error


test
notebooks


notebooks


filter out kernel not supporting submitcode


notebooks
Co-authored-by: Brett V. Forsgren <brettfo@microsoft.com>
}

export function getRawNotebookDocumentMetadataFromNotebookDocumentMetadata(notebookDocumentMetadata: NotebookDocumentMetadata, createForIpynb: boolean): { [key: string]: any } {
export function getRawNotebookDocumentMetadataFromNotebookDocumentMetadata(notebookDocumentMetadata: NotebookDocumentMetadata, documentRawMetadata: { [key: string]: any }, createForIpynb: boolean): { [key: string]: any } {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that this method is now doing more than one responsibility. Perhaps something like getAndMergetNotebookMetadata

Copy link
Member Author

Choose a reason for hiding this comment

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

good point, renamed

@colombod colombod enabled auto-merge (squash) March 7, 2023 21:18
@colombod colombod merged commit 00a468b into dotnet:main Mar 7, 2023
@colombod colombod deleted the notebookmodified branch March 7, 2023 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

notebook files are considered modified a few seconds after opening

5 participants