Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
void session.kernel.ready.then(() => {
const lang = session.kernel!.info!.language_info;
const mimeType = mimeService.getMimeTypeByLanguage(lang);
cellWidget.model.mimeType = mimeType;
});
}
});
// Use the default kernel.
session.kernelPreference = { autoStartDefault: true };
// Set up a completer.
const editor = cellWidget.editor;
const model = new CompleterModel();
const completer = new Completer({ editor, model });
const connector = new KernelConnector({ session });
const handler = new CompletionHandler({ completer, connector });
// Set the handler's editor.
handler.editor = editor;
// Hide the widget when it first loads.
completer.hide();
// Create a toolbar for the cell.
const toolbar = new Toolbar();
toolbar.addItem('spacer', Toolbar.createSpacerItem());
toolbar.addItem('interrupt', Toolbar.createInterruptButton(session));
toolbar.addItem('restart', Toolbar.createRestartButton(session));
toolbar.addItem('name', Toolbar.createKernelNameItem(session));
toolbar.addItem('status', Toolbar.createKernelStatusItem(session));
rendermime,
contentFactory,
mimeTypeService: editorServices.mimeTypeService
});
docRegistry.addModelFactory(mFactory);
docRegistry.addWidgetFactory(wFactory);
let notebookPath = PageConfig.getOption('notebookPath');
let nbWidget = docManager.open(notebookPath) as NotebookPanel;
let palette = new CommandPalette({ commands });
const editor =
nbWidget.content.activeCell && nbWidget.content.activeCell.editor;
const model = new CompleterModel();
const completer = new Completer({ editor, model });
const connector = new KernelConnector({ session: nbWidget.session });
const handler = new CompletionHandler({ completer, connector });
// Set the handler's editor.
handler.editor = editor;
// Listen for active cell changes.
nbWidget.content.activeCellChanged.connect((sender, cell) => {
handler.editor = cell && cell.editor;
});
// Hide the widget when it first loads.
completer.hide();
let panel = new SplitPanel();
panel.id = 'main';
panel.orientation = 'horizontal';
});
docRegistry.addModelFactory(mFactory);
docRegistry.addWidgetFactory(wFactory);
let notebookPath = PageConfig.getOption('notebookPath');
let nbWidget = docManager.open(notebookPath) as NotebookPanel;
// Create menu bar.
let menuBar = new MenuBar();
menuBar.addClass('notebookMenuBar');
const editor =
nbWidget.content.activeCell && nbWidget.content.activeCell.editor;
const model = new CompleterModel();
const completer = new Completer({ editor, model });
const connector = new KernelConnector({ session: nbWidget.session });
const handler = new CompletionHandler({ completer, connector });
// Set the handler's editor.
handler.editor = editor;
// Listen for active cell changes.
nbWidget.content.activeCellChanged.connect((sender, cell) => {
handler.editor = cell && cell.editor;
});
// Hide the widget when it first loads.
completer.hide();
// Create panel with menu bar above the notebook widget
let panel = new SplitPanel();
panel.id = 'main';
rendermime,
contentFactory,
mimeTypeService: editorServices.mimeTypeService
});
docRegistry.addModelFactory(mFactory);
docRegistry.addWidgetFactory(wFactory);
let notebookPath = PageConfig.getOption('notebookPath');
let nbWidget = docManager.open(notebookPath) as NotebookPanel;
let palette = new CommandPalette({ commands });
const editor =
nbWidget.content.activeCell && nbWidget.content.activeCell.editor;
const model = new CompleterModel();
const completer = new Completer({ editor, model });
const connector = new KernelConnector({ session: nbWidget.session });
const handler = new CompletionHandler({ completer, connector });
// Set the handler's editor.
handler.editor = editor;
// Listen for active cell changes.
nbWidget.content.activeCellChanged.connect((sender, cell) => {
handler.editor = cell && cell.editor;
});
// Hide the widget when it first loads.
completer.hide();
let panel = new SplitPanel();
panel.id = 'main';
panel.orientation = 'horizontal';
session.kernel.ready.then(() => {
const lang = session.kernel.info.language_info;
const mimeType = mimeService.getMimeTypeByLanguage(lang);
cellWidget.model.mimeType = mimeType;
});
});
// Start the default kernel.
session.kernelPreference = { autoStartDefault: true };
session.initialize();
// Set up a completer.
const editor = cellWidget.editor;
const model = new CompleterModel();
const completer = new Completer({ editor, model });
const connector = new KernelConnector({ session });
const handler = new CompletionHandler({ completer, connector });
// Set the handler's editor.
handler.editor = editor;
// Hide the widget when it first loads.
completer.hide();
// Create a toolbar for the cell.
const toolbar = new Toolbar();
toolbar.addItem('spacer', Toolbar.createSpacerItem());
toolbar.addItem('interrupt', Toolbar.createInterruptButton(session));
toolbar.addItem('restart', Toolbar.createRestartButton(session));
toolbar.addItem('name', Toolbar.createKernelNameItem(session));
toolbar.addItem('status', Toolbar.createKernelStatusItem(session));
constructor(props: CompleterProps) {
super(props);
const editor =
this.props.notebookPanel.content.activeCell &&
this.props.notebookPanel.content.activeCell.editor;
const model = new CompleterModel();
this.completer = new Completer({ editor, model });
const connector = new KernelConnector({
session: this.props.notebookPanel.session
});
this.handler = new CompletionHandler({
completer: this.completer,
connector
});
// Set the handler's editor.
this.handler.editor = editor;
// Listen for active cell changes.
this.props.notebookPanel.content.activeCellChanged.connect(
(sender, cell) => {
this.handler.editor = cell && cell.editor;
}
);
beforeAll(async () => {
session = await createClientSession();
await (session as ClientSession).initialize();
connector = new KernelConnector({ session });
});
constructor(options: LSPConnector.IOptions) {
super();
this._editor = options.editor;
this._connections = options.connections;
this.virtual_editor = options.virtual_editor;
this._context_connector = new ContextConnector({ editor: options.editor });
if (options.session) {
let kernel_options = { editor: options.editor, session: options.session };
this._kernel_connector = new KernelConnector(kernel_options);
this._kernel_and_context_connector = new CompletionConnector(
kernel_options
);
}
this.options = options;
}