Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export function debugYaml(pykisoConfigPath: vscode.Uri) {
module: "pykiso",
justMyCode: false,
args: ["-c", pykisoConfigPath.fsPath],
cwd: pykisoConfigPath.path.substring(0, pykisoConfigPath.path.lastIndexOf('/')),
purpose: ["debug-in-terminal"]
};

vscode.debug.startDebugging(workspaceFolder, pykisoDebugConfig);
Expand Down
20 changes: 14 additions & 6 deletions src/pykisoRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,25 @@ export class PykisoRunner {
var activeFile = filePath!.split("\\").pop()!.split("/").pop();
this.updatePythonInterpreter();

var filePathUri = vscode.Uri.parse(filePath);

if (!debug) {
var terminal = vscode.window.createTerminal(
`Pykiso #${this.nextTermID++} ${activeFile}`
);
const terminalOptions = {
name: `Pykiso #${this.nextTermID++} ${activeFile}`,
cwd: filePathUri.path.substring(0, filePathUri.path.lastIndexOf('/')),
};

var terminal = vscode.window.createTerminal(terminalOptions);
terminal.sendText(
`${this.pythonInterpreterPath} -m pykiso -c \"${filePath}\"`
);
} else {
var terminal = vscode.window.createTerminal(
`Pykiso DEBUG #${this.nextTermID++} ${activeFile}`
);
const terminalOptions = {
name: `Pykiso DEBUG #${this.nextTermID++} ${activeFile}`,
cwd: filePathUri.path.substring(0, filePathUri.path.lastIndexOf('/')),
};

var terminal = vscode.window.createTerminal(terminalOptions);
terminal.sendText(
`${this.pythonInterpreterPath} -m pykiso -c \"${filePath}\" --log-level DEBUG`
);
Expand Down
6 changes: 3 additions & 3 deletions src/test/suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ suite("Extension Test Suite", () => {

assert(stubUpdatePythonInterpreter.calledOnce);
assert(stubCreateTerminal.calledOnce);
expect(stubCreateTerminal).to.be.called.calledWith("Pykiso #1 dummy.yaml");
expect(stubCreateTerminal).to.be.called.calledWith({ name: 'Pykiso #1 dummy.yaml', cwd: '' });
expect(stubTerminal.sendText).to.be.called.calledWith(
'C:/Python -m pykiso -c "/dummy.yaml"'
);
Expand Down Expand Up @@ -66,8 +66,8 @@ suite("Extension Test Suite", () => {
assert(stubUpdatePythonInterpreter.calledTwice);
assert(stubCreateTerminal.calledTwice);
expect(stubCreateTerminal)
.to.be.called.calledWith("Pykiso DEBUG #1 dummy.yaml")
.calledWith("Pykiso DEBUG #2 dummy.yaml");
.to.be.called.calledWith({ name: 'Pykiso DEBUG #1 dummy.yaml', cwd: '' })
.calledWith({ name: 'Pykiso DEBUG #2 dummy.yaml', cwd: '/somePath' });

expect(stubTerminal.sendText).to.be.called.calledWith(
'C:/Python -m pykiso -c "/dummy.yaml" --log-level DEBUG'
Expand Down