Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Remove execute method from DebugSession
Browse files Browse the repository at this point in the history
  • Loading branch information
jtpio committed Aug 22, 2019
1 parent bae4841 commit 3c53f15
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 36 deletions.
31 changes: 1 addition & 30 deletions src/session.ts
Expand Up @@ -5,7 +5,7 @@ import { IClientSession } from '@jupyterlab/apputils';

import { CodeEditor } from '@jupyterlab/codeeditor';

import { KernelMessage, Kernel } from '@jupyterlab/services';
import { KernelMessage } from '@jupyterlab/services';

import { PromiseDelegate } from '@phosphor/coreutils';

Expand Down Expand Up @@ -41,9 +41,6 @@ export class DebugSession implements IDebugger.ISession {
if (this.isDisposed) {
return;
}
if (this._executeFuture) {
this._executeFuture.dispose();
}
this._isDisposed = true;
this._disposed.emit();
Signal.clearData(this);
Expand Down Expand Up @@ -93,13 +90,6 @@ export class DebugSession implements IDebugger.ISession {
});
}

/**
* Request code execution.
*/
async execute(code: string): Promise<void> {
await this._sendExecuteMessage({ code });
}

/**
* Send a custom debug request to the kernel.
* @param command debug command.
Expand Down Expand Up @@ -157,27 +147,8 @@ export class DebugSession implements IDebugger.ISession {
return reply.promise;
}

/**
* Send an execute request message to the kernel.
* @param msg execute request message to send to the kernel.
*/
private async _sendExecuteMessage(
msg: KernelMessage.IExecuteRequestMsg['content']
): Promise<void> {
const kernel = this.client.kernel;
if (this._executeFuture) {
this._executeFuture.dispose();
}
this._executeFuture = kernel.requestExecute(msg);
this._executeFuture.onReply = (msg: KernelMessage.IExecuteReplyMsg) => {};
}

private _disposed = new Signal<this, void>(this);
private _isDisposed: boolean = false;
private _executeFuture: Kernel.IShellFuture<
KernelMessage.IExecuteRequestMsg,
KernelMessage.IExecuteReplyMsg
> | null = null;
private _eventMessage = new Signal<DebugSession, IDebugger.ISession.Event>(
this
);
Expand Down
5 changes: 0 additions & 5 deletions src/tokens.ts
Expand Up @@ -51,11 +51,6 @@ export namespace IDebugger {
* Stop a running debug session.
*/
stop(): void;

/**
* Send a request to execute code.
*/
execute(code: string): Promise<void>;
}

export namespace ISession {
Expand Down
4 changes: 3 additions & 1 deletion tests/src/session.spec.ts
Expand Up @@ -141,7 +141,9 @@ describe('protocol', () => {
sourceModified: false
});
await debugSession.sendRequest('configurationDone', {});
void debugSession.execute(code);

// trigger an execute_request
client.kernel.requestExecute({ code });

// TODO: handle events instead
await sleep(2000);
Expand Down

0 comments on commit 3c53f15

Please sign in to comment.