mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 17:22:20 -05:00
Nb/open book without reload (#6635)
* initial commit * fix: added initialize method to fix the previous/next links rendering * added checks * open first markdown/ipynb in the book ans expand the view * added launch book from command pallete, removed the pick folder and save option added launching the first notebook/markdown * moved the open book command pallet action from mssql to notebooks * open as untitled to true * opening markdown files issue fix * removed opening as untitled files * open ipynb files as untitled and changes for previous&next links to work * add books as seperate viewlet * localize double quote issues and renamed treeCollapsibleState * renames and added logic to conditionally show Preview command * moved registerCommands from widget to extension contribution * isEditorUntitled check * async comment updates * formatting issues. * promisfying the async calls * moved existsAsync to top
This commit is contained in:
@@ -16,6 +16,7 @@ import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import * as fs from 'fs';
|
||||
|
||||
import {
|
||||
SqlMainContext, MainThreadNotebookDocumentsAndEditorsShape, SqlExtHostContext, ExtHostNotebookDocumentsAndEditorsShape,
|
||||
@@ -698,13 +699,25 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
|
||||
onNext: async (uri) => {
|
||||
let result = await this._proxy.$getNavigation(handle, uri);
|
||||
if (result) {
|
||||
this.doOpenEditor(result.next, {});
|
||||
if (uri.scheme === Schemas.untitled) {
|
||||
let untitledNbName: URI = URI.parse(`untitled:${path.basename(result.next.path, '.ipynb')}`);
|
||||
this.doOpenEditor(untitledNbName, { initialContent: fs.readFileSync(result.next.path).toString(), initialDirtyState: false });
|
||||
}
|
||||
else {
|
||||
this.doOpenEditor(result.next, {});
|
||||
}
|
||||
}
|
||||
},
|
||||
onPrevious: async (uri) => {
|
||||
let result = await this._proxy.$getNavigation(handle, uri);
|
||||
if (result) {
|
||||
this.doOpenEditor(result.previous, {});
|
||||
if (uri.scheme === Schemas.untitled) {
|
||||
let untitledNbName: URI = URI.parse(`untitled:${path.basename(result.previous.path, '.ipynb')}`);
|
||||
this.doOpenEditor(untitledNbName, { initialContent: fs.readFileSync(result.previous.path).toString(), initialDirtyState: false });
|
||||
}
|
||||
else {
|
||||
this.doOpenEditor(result.previous, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user