Skip to content
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

Add restorer to code snippet extension #553

Merged
merged 1 commit into from
May 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/code-snippet/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import { codeSnippetIcon } from '@elyra/application';

import {
JupyterFrontEnd,
JupyterFrontEndPlugin
JupyterFrontEndPlugin,
ILayoutRestorer
} from '@jupyterlab/application';
import { ICommandPalette } from '@jupyterlab/apputils';

Expand All @@ -36,8 +37,12 @@ const CODE_SNIPPET_EXTENSION_ID = 'elyra-code-snippet-extension';
export const code_snippet_extension: JupyterFrontEndPlugin<void> = {
id: CODE_SNIPPET_EXTENSION_ID,
autoStart: true,
requires: [ICommandPalette],
activate: (app: JupyterFrontEnd, palette: ICommandPalette) => {
requires: [ICommandPalette, ILayoutRestorer],
activate: (
app: JupyterFrontEnd,
palette: ICommandPalette,
restorer: ILayoutRestorer
) => {
console.log('Elyra - code-snippet extension is activated!');

const getCurrentWidget = (): Widget => {
Expand All @@ -49,6 +54,8 @@ export const code_snippet_extension: JupyterFrontEndPlugin<void> = {
codeSnippetWidget.title.icon = codeSnippetIcon;
codeSnippetWidget.title.caption = 'Code Snippet';

restorer.add(codeSnippetWidget, CODE_SNIPPET_EXTENSION_ID);

// Rank has been chosen somewhat arbitrarily to give priority to the running
// sessions widget in the sidebar.
app.shell.add(codeSnippetWidget, 'left', { rank: 900 });
Expand Down