-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix a number of issues related to opening new notebooks #8270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
52b5855
c5ade51
010d869
519294c
e9534bb
222f990
e1d7906
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
When creating a new blank notebook, it has existing text in it already. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Cannot create more than one blank notebook. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
When updating the Python extension, unsaved changes to notebooks are lost. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,7 @@ suite('Data Science - Native Editor', () => { | |
let jupyterDebugger: IJupyterDebugger; | ||
let importer: INotebookImporter; | ||
let storage: MockMemento; | ||
let localStorage: MockMemento; | ||
let storageUpdateSpy: sinon.SinonSpy<[string, any], Thenable<void>>; | ||
const baseFile = `{ | ||
"cells": [ | ||
|
@@ -185,6 +186,7 @@ suite('Data Science - Native Editor', () => { | |
|
||
setup(() => { | ||
storage = new MockMemento(); | ||
localStorage = new MockMemento(); | ||
storageUpdateSpy = sinon.spy(storage, 'update'); | ||
configService = mock(ConfigurationService); | ||
fileSystem = mock(FileSystem); | ||
|
@@ -253,7 +255,8 @@ suite('Data Science - Native Editor', () => { | |
instance(jupyterDebugger), | ||
instance(importer), | ||
instance(dsErrorHandler), | ||
storage | ||
storage, | ||
localStorage | ||
); | ||
} | ||
|
||
|
@@ -429,11 +432,11 @@ suite('Data Science - Native Editor', () => { | |
expect(contents.metadata!.language_info!.version).to.not.equal('10.11.12'); | ||
|
||
// When a cell is executed, then ensure we store the python version info in the notebook data. | ||
const version: Version = {build: [], major: 10, minor: 11, patch: 12, prerelease: [], raw: '10.11.12'}; | ||
when(executionProvider.getUsableJupyterPython()).thenResolve(({version} as any)); | ||
const version: Version = { build: [], major: 10, minor: 11, patch: 12, prerelease: [], raw: '10.11.12' }; | ||
when(executionProvider.getUsableJupyterPython()).thenResolve(({ version } as any)); | ||
|
||
try { | ||
editor.onMessage(InteractiveWindowMessages.SubmitNewCell, {code: 'hello', id: '1'}); | ||
editor.onMessage(InteractiveWindowMessages.SubmitNewCell, { code: 'hello', id: '1' }); | ||
} catch { | ||
// Ignore errors related to running cells, assume that works. | ||
noop(); | ||
|
@@ -453,4 +456,23 @@ suite('Data Science - Native Editor', () => { | |
contents = JSON.parse(editor.contents) as nbformat.INotebookContent; | ||
expect(contents.metadata!.language_info!.version).to.equal('10.11.12'); | ||
}); | ||
|
||
test('Opening file with local storage but no global will still open with old contents', async () => { | ||
// This test is really for making sure when a user upgrades to a new extension, we still have their old storage | ||
const file = Uri.parse('file://foo.ipynb'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Take a peek at this in the debugger quick. I think the specification is incorrect here (though the test might pass). 'file://foo.ipynb' doesn't set the fsPath and puts the filename in the authority. 'file:///foo.ipynb' works. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes you're right. The file name comes out as /. I'll change it and see if the tests still pass There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good, when you do that could you take a look at the other places that we do that in this file? Just so we don't get bit by this later? I should have already done that with my checkin when I noticed the issue, but I forgot to add them in. In reply to: 340233792 [](ancestors = 340233792) |
||
|
||
// Initially nothing in memento | ||
expect(storage.get(`notebook-storage-${file.toString()}`)).to.be.undefined; | ||
expect(localStorage.get(`notebook-storage-${file.toString()}`)).to.be.undefined; | ||
|
||
// Put the regular file into the local storage | ||
localStorage.update(`notebook-storage-${file.toString()}`, baseFile); | ||
const editor = createEditor(); | ||
await editor.load('', file); | ||
|
||
// It should load with that value | ||
expect(editor.contents).to.be.equal(baseFile); | ||
expect(editor.cells).to.be.lengthOf(3); | ||
|
||
}); | ||
}); |
Uh oh!
There was an error while loading. Please reload this page.