-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
put stdout / stderr in output channel instead of cell output
fixes #40
- Loading branch information
Jake Donham
committed
Jun 21, 2024
1 parent
5121bb6
commit 608f8f4
Showing
11 changed files
with
91 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,3 @@ | ||
import { window } from "vscode"; | ||
|
||
const _log = window.createOutputChannel("Vitale"); | ||
export const log = { | ||
info: (...args: any[]) => { | ||
// eslint-disable-next-line no-console | ||
console.log(...args); | ||
const time = new Date().toLocaleTimeString(); | ||
_log.appendLine(`[INFO ${time}] ${args.join(" ")}`); | ||
}, | ||
error: (...args: any[]) => { | ||
console.error(...args); | ||
const time = new Date().toLocaleTimeString(); | ||
for (let i = 0; i < args.length; i++) { | ||
if (args[i] instanceof Error) { | ||
const err = args[i] as Error; | ||
args[i] = `[Error ${err.name}] ${err.message}\n${err.stack}`; | ||
} | ||
} | ||
_log.appendLine(`[Error ${time}] ${args.join(" ")}`); | ||
}, | ||
workspaceInfo: (folder: string, ...args: any[]) => { | ||
log.info(`[Workspace ${folder}]`, ...args); | ||
}, | ||
workspaceError: (folder: string, ...args: any[]) => { | ||
log.error(`[Workspace ${folder}]`, ...args); | ||
}, | ||
} as const; | ||
export const log = window.createOutputChannel("Vitale", { log: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as vscode from "vscode"; | ||
|
||
export const showStdout = async (cell: vscode.NotebookCell) => { | ||
const name = `${cell.notebook.uri.fsPath}-${cell.metadata.id}-stdout`; | ||
const channel = vscode.window.createOutputChannel(name, { log: true }); | ||
channel.show(/* preserveFocus: */ true); | ||
}; |