|
@@ -4,20 +4,21 @@
|
|
import {
|
|
import {
|
|
ILayoutRestorer,
|
|
ILayoutRestorer,
|
|
JupyterFrontEnd,
|
|
JupyterFrontEnd,
|
|
- JupyterFrontEndPlugin
|
|
|
|
|
|
+ JupyterFrontEndPlugin,
|
|
|
|
+ LabShell
|
|
} from '@jupyterlab/application';
|
|
} from '@jupyterlab/application';
|
|
|
|
|
|
import { ICommandPalette } from '@jupyterlab/apputils';
|
|
import { ICommandPalette } from '@jupyterlab/apputils';
|
|
|
|
|
|
import { WidgetTracker, MainAreaWidget } from '@jupyterlab/apputils';
|
|
import { WidgetTracker, MainAreaWidget } from '@jupyterlab/apputils';
|
|
|
|
|
|
-import { IConsoleTracker } from '@jupyterlab/console';
|
|
|
|
|
|
+import { IConsoleTracker, ConsolePanel } from '@jupyterlab/console';
|
|
|
|
|
|
import { IStateDB } from '@jupyterlab/coreutils';
|
|
import { IStateDB } from '@jupyterlab/coreutils';
|
|
|
|
|
|
import { IEditorTracker } from '@jupyterlab/fileeditor';
|
|
import { IEditorTracker } from '@jupyterlab/fileeditor';
|
|
|
|
|
|
-import { INotebookTracker } from '@jupyterlab/notebook';
|
|
|
|
|
|
+import { INotebookTracker, NotebookPanel } from '@jupyterlab/notebook';
|
|
|
|
|
|
import { Debugger } from './debugger';
|
|
import { Debugger } from './debugger';
|
|
|
|
|
|
@@ -25,7 +26,8 @@ import { Debugger } from './debugger';
|
|
|
|
|
|
import { IDebugger, IDebuggerSidebar } from './tokens';
|
|
import { IDebugger, IDebuggerSidebar } from './tokens';
|
|
import { DebuggerNotebookTracker } from './notebookTracker';
|
|
import { DebuggerNotebookTracker } from './notebookTracker';
|
|
-import { BreakpointsService } from './breakpointsService';
|
|
|
|
|
|
+import { BreakpointsService, SessionTypes } from './breakpointsService';
|
|
|
|
+
|
|
import { DebuggerConsoleTracker } from './consoleTracker';
|
|
import { DebuggerConsoleTracker } from './consoleTracker';
|
|
|
|
|
|
// import { ClientSession, IClientSession } from '@jupyterlab/apputils';
|
|
// import { ClientSession, IClientSession } from '@jupyterlab/apputils';
|
|
@@ -54,7 +56,7 @@ const breakpointService = new BreakpointsService();
|
|
const consoles: JupyterFrontEndPlugin<void> = {
|
|
const consoles: JupyterFrontEndPlugin<void> = {
|
|
id: '@jupyterlab/debugger:consoles',
|
|
id: '@jupyterlab/debugger:consoles',
|
|
autoStart: true,
|
|
autoStart: true,
|
|
- requires: [IDebugger, IConsoleTracker, IEditorTracker],
|
|
|
|
|
|
+ requires: [IDebugger, IConsoleTracker],
|
|
activate: (_, debug, tracker: IConsoleTracker) => {
|
|
activate: (_, debug, tracker: IConsoleTracker) => {
|
|
new DebuggerConsoleTracker({
|
|
new DebuggerConsoleTracker({
|
|
consoleTracker: tracker,
|
|
consoleTracker: tracker,
|
|
@@ -69,8 +71,21 @@ const consoles: JupyterFrontEndPlugin<void> = {
|
|
const files: JupyterFrontEndPlugin<void> = {
|
|
const files: JupyterFrontEndPlugin<void> = {
|
|
id: '@jupyterlab/debugger:files',
|
|
id: '@jupyterlab/debugger:files',
|
|
autoStart: true,
|
|
autoStart: true,
|
|
- optional: [IEditorTracker],
|
|
|
|
|
|
+ requires: [IEditorTracker],
|
|
activate: (app: JupyterFrontEnd, tracker: IEditorTracker | null) => {
|
|
activate: (app: JupyterFrontEnd, tracker: IEditorTracker | null) => {
|
|
|
|
+ const shell = app.shell;
|
|
|
|
+
|
|
|
|
+ (shell as LabShell).currentChanged.connect((sender, update) => {
|
|
|
|
+ const newWidget = update.newValue;
|
|
|
|
+ const session =
|
|
|
|
+ newWidget && (newWidget as NotebookPanel | ConsolePanel).session
|
|
|
|
+ ? (newWidget as NotebookPanel | ConsolePanel).session
|
|
|
|
+ : false;
|
|
|
|
+ if (session) {
|
|
|
|
+ breakpointService.type = session.type as SessionTypes;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
app.commands.addCommand(CommandIDs.debugFile, {
|
|
app.commands.addCommand(CommandIDs.debugFile, {
|
|
execute: async _ => {
|
|
execute: async _ => {
|
|
if (!tracker || !tracker.currentWidget) {
|
|
if (!tracker || !tracker.currentWidget) {
|
|
@@ -105,7 +120,6 @@ const notebooks: JupyterFrontEndPlugin<void> = {
|
|
breakpointService: breakpointService
|
|
breakpointService: breakpointService
|
|
});
|
|
});
|
|
|
|
|
|
- // console.log(debugetNoteTracker);
|
|
|
|
// this exist only for my test in futre will be removed
|
|
// this exist only for my test in futre will be removed
|
|
const command: string = CommandIDs.debugNotebook;
|
|
const command: string = CommandIDs.debugNotebook;
|
|
app.commands.addCommand(command, {
|
|
app.commands.addCommand(command, {
|
|
@@ -122,7 +136,7 @@ const notebooks: JupyterFrontEndPlugin<void> = {
|
|
*/
|
|
*/
|
|
const sidebar: JupyterFrontEndPlugin<Debugger> = {
|
|
const sidebar: JupyterFrontEndPlugin<Debugger> = {
|
|
id: '@jupyterlab/debugger:sidebar',
|
|
id: '@jupyterlab/debugger:sidebar',
|
|
- optional: [ILayoutRestorer, INotebookTracker, IEditorTracker],
|
|
|
|
|
|
+ optional: [ILayoutRestorer],
|
|
autoStart: true,
|
|
autoStart: true,
|
|
activate: (
|
|
activate: (
|
|
app: JupyterFrontEnd,
|
|
app: JupyterFrontEnd,
|