Skip to content

Commit

Permalink
Add showOutput() method (posit-dev/positron-python#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel- authored and wesm committed Mar 28, 2024
1 parent 6d7b31b commit 443460f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions extensions/positron-python/positron-dts/positron.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@ declare module 'positron' {
* should forcibly terminate any underlying processes.
*/
forceQuit(): Thenable<void>;

/**
* Show runtime log in output panel.
*/
showOutput?(): void;
}


Expand Down
20 changes: 20 additions & 0 deletions extensions/positron-python/src/client/jupyter-adapter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,33 @@ export interface JupyterLanguageRuntime extends positron.LanguageRuntime {
*/
startPositronLsp(clientAddress: string): Thenable<void>;

/**
* Convenience method for starting the Positron DAP server, if the
* language runtime supports it.
*
* @param serverPort The port on which to bind locally.
* @param debugType Passed as `vscode.DebugConfiguration.type`.
* @param debugName Passed as `vscode.DebugConfiguration.name`.
*/
startPositronDap(
serverPort: number,
debugType: string,
debugName: string,
): Thenable<void>;

/**
* Method for emitting a message to the language server's Jupyter output
* channel.
*
* @param message A message to emit to the Jupyter log.
*/
emitJupyterLog(message: string): void;

/**
* A Jupyter kernel is guaranteed to have a `showOutput()`
* method, so we declare it non-optional.
*/
showOutput(): void;
}

/**
Expand Down
4 changes: 4 additions & 0 deletions extensions/positron-python/src/client/positron/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ export class PythonRuntime implements positron.LanguageRuntime, vscode.Disposabl
}
}

showOutput(): void {
this._kernel?.showOutput();
}

async forceQuit(): Promise<void> {
if (this._kernel) {
// Stop the LSP client before shutting down the kernel. We only give
Expand Down

0 comments on commit 443460f

Please sign in to comment.