Skip to content

Commit

Permalink
Rename interface
Browse files Browse the repository at this point in the history
  • Loading branch information
renkun-ken committed Oct 12, 2020
1 parent 36d21fe commit 880494c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/notebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import net = require('net');
import { spawn, ChildProcess } from 'child_process';
import { dirname } from 'path';

interface RSessionRequest {
interface RKernelRequest {
id: number;
type: 'eval' | 'cancel';
expr?: any;
}

interface RSessionResponse {
interface RKernelResponse {
id: number;
type: 'text' | 'plot' | 'viewer' | 'browser' | 'error';
result: string;
Expand All @@ -29,7 +29,7 @@ class RKernel {
this.doc = doc;
}

private request(request: RSessionRequest) {
private request(request: RKernelRequest) {
if (this.socket) {
const json = JSON.stringify(request);
this.socket.write(`Content-Length: ${json.length}\n${json}`);
Expand Down Expand Up @@ -93,11 +93,11 @@ class RKernel {
await this.start();
}

public async eval(cell: vscode.NotebookCell): Promise<RSessionResponse> {
public async eval(cell: vscode.NotebookCell): Promise<RKernelResponse> {
if (this.socket) {
return new Promise((resolve, reject) => {
const handler = async (data: Buffer) => {
const response: RSessionResponse = JSON.parse(data.toString());
const response: RKernelResponse = JSON.parse(data.toString());
resolve(response);
this.socket.removeListener('data', handler);
};
Expand Down Expand Up @@ -140,7 +140,7 @@ class RNotebook implements vscode.Disposable {
this.kernel.restart();
}

public async eval(cell: vscode.NotebookCell): Promise<RSessionResponse> {
public async eval(cell: vscode.NotebookCell): Promise<RKernelResponse> {
await this.kernel.start();
return this.kernel.eval(cell);
}
Expand Down

0 comments on commit 880494c

Please sign in to comment.