Skip to content

Commit 45e0142

Browse files
committed
some log messages
1 parent 42349a6 commit 45e0142

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/extension.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,23 @@ function showButtons() {
4444
}
4545

4646
async function startTerminal(
47-
existing: vscode.Terminal | undefined, name: string, cmd: string
47+
existing: vscode.Terminal | undefined, name: string, cmd: string, outChannel: vscode.OutputChannel
4848
): Promise<vscode.Terminal> {
4949
let terminal: vscode.Terminal | undefined;
5050
if (existing) {
5151
// We try to re-use the existing terminal. But we need to terminate a potentially
5252
// running python process first. If there is no python process, the shell
53-
// complains about the "import sys; sys.exit(0)" command, but we don't care.
53+
// complains about the "import sys; sys.exit(0)" command, but we do not care.
5454
if (!existing.exitStatus) {
55+
outChannel.appendLine("Reusing existing terminal");
5556
terminal = existing;
5657
terminal.sendText("import sys; sys.exit(0)");
5758
} else {
59+
outChannel.appendLine("Disposing existing terminal because it's already terminated");
5860
existing.dispose();
5961
}
62+
} else {
63+
outChannel.appendLine("No terminal exists yet, creating new terminal");
6064
}
6165
if (!terminal) {
6266
const terminalOptions: vscode.TerminalOptions = {name: name};
@@ -434,6 +438,7 @@ export async function activate(context: vscode.ExtensionContext) {
434438

435439
const outChannel = vscode.window.createOutputChannel("Write Your Python Program");
436440
disposables.push(outChannel);
441+
outChannel.appendLine('Write Your Python Program extension activated.');
437442

438443
const terminals: { [name: string]: TerminalContext } = {};
439444
vscode.window.onDidCloseTerminal((t) => {
@@ -497,7 +502,8 @@ export async function activate(context: vscode.ExtensionContext) {
497502
disableOpt + langOpt +
498503
" --interactive " +
499504
" --change-directory " +
500-
fileToCommandArgument(file)
505+
fileToCommandArgument(file),
506+
outChannel
501507
);
502508
terminals[cmdId] = {terminal: cmdTerm, directory: path.dirname(file)};
503509
if (pyCmd.kind === "warning") {

0 commit comments

Comments
 (0)