mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -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, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,6 +23,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IViewContainersRegistry, Extensions as ViewContainerExtensions, ViewContainer } from 'vs/workbench/common/views';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { NodeContextKey } from 'sql/workbench/parts/dataExplorer/common/nodeContext';
|
||||
import { MssqlNodeContext } from 'sql/workbench/parts/dataExplorer/common/mssqlNodeContext';
|
||||
@@ -157,6 +158,22 @@ configurationRegistry.registerConfiguration({
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Explorer viewlet id.
|
||||
*/
|
||||
export const VIEWLET_ID = 'bookTreeView';
|
||||
/**
|
||||
* Explorer viewlet container.
|
||||
*/
|
||||
export const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer(VIEWLET_ID);
|
||||
registerAction({
|
||||
id: 'workbench.books.action.focusBooksExplorer',
|
||||
handler: async (accessor) => {
|
||||
const viewletService = accessor.get(IViewletService);
|
||||
viewletService.openViewlet('workbench.view.extension.books-explorer', true);
|
||||
}
|
||||
});
|
||||
|
||||
/* *************** Output components *************** */
|
||||
// Note: most existing types use the same component to render. In order to
|
||||
// preserve correct rank order, we register it once for each different rank of
|
||||
|
||||
Reference in New Issue
Block a user