Skip to content

Conversation

@rchiodo
Copy link

@rchiodo rchiodo commented May 19, 2020

For #11711

Make it so we use hot exit storage for untitled files too.

In addition to this (since you can't open an untitled file), open all unclosed notebooks on reopen of the extension.

@rchiodo rchiodo marked this pull request as ready for review May 19, 2020 23:58
@rchiodo rchiodo self-assigned this May 19, 2020
@rchiodo rchiodo changed the title Rchiodo/fix 11711 Support hot exit storage for untitled notebooks May 20, 2020

const MEMENTO_KEY = 'nativeEditorViewTracking';
@injectable()
export class NativeEditorViewTracker implements IExtensionSingleActivationService {
Copy link
Author

@rchiodo rchiodo May 20, 2020

Choose a reason for hiding this comment

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

Whoops, need a class comment. #Resolved

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 1 Security Hotspot to review)
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

return registeredProvider;
}

test('Opening a notebook', async () => {
Copy link
Author

Choose a reason for hiding this comment

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

These tests used to be unit tests, but I changed them to functional so that they would test more of the storage code at once.

await this.fileSystem.createDirectory(path.dirname(filePath));
if (!cancelToken?.isCancellationRequested) {
return this.fileSystem.writeFile(filePath, contents);
return await this.fileSystem.writeFile(filePath, contents);
Copy link
Member

Choose a reason for hiding this comment

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

Why did you need the awaits on the returns here?

Copy link
Author

Choose a reason for hiding this comment

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

So that exceptions stay within the try block

Copy link
Author

Choose a reason for hiding this comment

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

This is the situation I explained in a friday meeting a while back.

@rchiodo rchiodo merged commit 06af191 into master May 20, 2020
@rchiodo rchiodo deleted the rchiodo/fix_11711 branch May 20, 2020 15:52
@dimitry-ishenko
Copy link

Gentlemen, FYI this implementation is very buggy.

If I have one or more notebooks open, eg:

Screenshot from 2020-05-29 17-31-38

and I close and reopen vscode (insiders edition) I get this:

Screenshot from 2020-05-29 17-32-09

I think to myself "Hmm, that's weird... the notebook didn't reopen". I then proceed to open the notebook manually and all of a sudden I now have two copies of the same notebook: 😨

Screenshot from 2020-05-29 17-32-33

This is also exacerbated by the fact that both of the notebooks are marked with the asterisk (*) even though I didn't make any changes (as in screenshots above).

@rchiodo
Copy link
Author

rchiodo commented May 29, 2020

This is a side effect of our extension not 'loading' when you reopen. You have to open some other file or run some Python command to get the extension to load. Then the files open.

We likely need some help from VS code to fix this (or just wait for us to switch to the new VS code notebook api). We need for them to provide a way for us to auto load only in certain circumstances.

See this issue here:
https://github.com/microsoft/vscode-python/issues/11917

@dimitry-ishenko
Copy link

@rchiodo thank you for the clarification. I guess this is another thing pivoting around #7903 😞

@rchiodo
Copy link
Author

rchiodo commented May 30, 2020

I guess this is another thing pivoting around #7903

Yep, that would fix it too as we wouldn't need to have our own way to open the files.

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.

4 participants