Skip to content

Commit ee5547e

Browse files
author
MikhailArkhipov
committed
2 parents 3a2e2b7 + 23b9c38 commit ee5547e

File tree

8 files changed

+114
-74
lines changed

8 files changed

+114
-74
lines changed

package.json

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -932,10 +932,9 @@
932932
"name": "Python Experimental: Terminal (integrated)",
933933
"type": "pythonExperimental",
934934
"request": "launch",
935-
"stopOnEntry": true,
936935
"pythonPath": "^\"\\${config:python.pythonPath}\"",
937936
"program": "^\"\\${file}\"",
938-
"cwd": "",
937+
"cwd": "^\"\\${workspaceFolder}\"",
939938
"console": "integratedTerminal",
940939
"env": {},
941940
"envFile": "^\"\\${workspaceFolder}/.env\"",
@@ -950,16 +949,37 @@
950949
"name": "Python Experimental: Terminal (external)",
951950
"type": "pythonExperimental",
952951
"request": "launch",
953-
"stopOnEntry": true,
954952
"pythonPath": "^\"\\${config:python.pythonPath}\"",
955953
"program": "^\"\\${file}\"",
956-
"cwd": "",
954+
"cwd": "^\"\\${workspaceFolder}\"",
957955
"console": "externalTerminal",
958956
"env": {},
959957
"envFile": "^\"\\${workspaceFolder}/.env\"",
960958
"debugOptions": [],
961959
"internalConsoleOptions": "neverOpen"
962960
}
961+
},
962+
{
963+
"label": "Python Experimental: Django",
964+
"description": "%python.snippet.launch.django.description%",
965+
"body": {
966+
"name": "Django",
967+
"type": "python",
968+
"request": "launch",
969+
"pythonPath": "^\"\\${config:python.pythonPath}\"",
970+
"program": "^\"\\${workspaceFolder}/manage.py\"",
971+
"cwd": "^\"\\${workspaceFolder}\"",
972+
"console": "integratedTerminal",
973+
"internalConsoleOptions": "neverOpen",
974+
"args": [
975+
"runserver",
976+
"--noreload",
977+
"--nothreading"
978+
],
979+
"env": {},
980+
"envFile": "^\"\\${workspaceFolder}/.env\"",
981+
"debugOptions": []
982+
}
963983
}
964984
],
965985
"configurationAttributes": {
@@ -1052,20 +1072,38 @@
10521072
"request": "launch",
10531073
"pythonPath": "${config:python.pythonPath}",
10541074
"program": "${file}",
1055-
"cwd": "",
1075+
"cwd": "${workspaceFolder}",
10561076
"console": "integratedTerminal",
10571077
"env": {},
10581078
"envFile": "${workspaceFolder}/.env",
10591079
"debugOptions": [],
10601080
"internalConsoleOptions": "neverOpen"
10611081
},
1082+
{
1083+
"name": "Python Experimental: Django",
1084+
"type": "pythonExperimental",
1085+
"request": "launch",
1086+
"pythonPath": "${config:python.pythonPath}",
1087+
"program": "${workspaceFolder}/manage.py",
1088+
"cwd": "${workspaceFolder}",
1089+
"console": "integratedTerminal",
1090+
"env": {},
1091+
"envFile": "${workspaceFolder}/.env",
1092+
"args": [
1093+
"runserver",
1094+
"--noreload",
1095+
"--nothreading"
1096+
],
1097+
"debugOptions": [],
1098+
"internalConsoleOptions": "neverOpen"
1099+
},
10621100
{
10631101
"name": "Python Experimental: Current File (External Terminal)",
10641102
"type": "pythonExperimental",
10651103
"request": "launch",
10661104
"pythonPath": "${config:python.pythonPath}",
10671105
"program": "${file}",
1068-
"cwd": "",
1106+
"cwd": "${workspaceFolder}",
10691107
"console": "externalTerminal",
10701108
"env": {},
10711109
"envFile": "${workspaceFolder}/.env",

src/client/debugger/Main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ export class PythonDebugger extends LoggingDebugSession {
486486
return new StackFrame(frameId, frame.FunctionName,
487487
new Source(path.basename(frame.FileName), fileName),
488488
this.convertDebuggerLineToClient(frame.LineNo - 1),
489-
0);
489+
1);
490490
}
491491
});
492492
});

src/test/common/process/proc.observable.test.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { expect, use } from 'chai';
55
import * as chaiAsPromised from 'chai-as-promised';
66
import { CancellationTokenSource } from 'vscode';
77
import { PythonSettings } from '../../../client/common/configSettings';
8+
import { createDeferred } from '../../../client/common/helpers';
89
import { BufferDecoder } from '../../../client/common/process/decoder';
910
import { ProcessService } from '../../../client/common/process/proc';
1011
import { initialize } from './../../initialize';
@@ -85,17 +86,27 @@ suite('ProcessService', () => {
8586
const cancellationToken = new CancellationTokenSource();
8687
const result = procService.execObservable(pythonPath, ['-c', pythonCode.join(';')], { token: cancellationToken.token });
8788

89+
const def = createDeferred();
90+
def.promise.then(done).catch(done);
8891
expect(result).not.to.be.an('undefined', 'result is undefined');
8992
result.out.subscribe(output => {
9093
const value = output.out.trim();
9194
if (value === '1') {
9295
cancellationToken.cancel();
9396
} else {
94-
done('Output received when we shouldn\'t have.');
97+
if (!def.completed) {
98+
def.reject('Output received when we shouldn\'t have.');
99+
}
95100
}
96101
}, done, () => {
97-
const errorMsg = cancellationToken.token.isCancellationRequested ? undefined : 'Program terminated even before cancelling it.';
98-
done(errorMsg);
102+
if (def.completed) {
103+
return;
104+
}
105+
if (cancellationToken.token.isCancellationRequested) {
106+
def.resolve();
107+
} else {
108+
def.reject('Program terminated even before cancelling it.');
109+
}
99110
});
100111
});
101112

src/test/debugger/attach.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ suite('Attach Debugger', () => {
9999
await attachedOutputReceived;
100100

101101
// Add a breakpoint.
102-
const breakpointLocation = { path: fileToDebug, column: 0, line: 16 };
102+
const breakpointLocation = { path: fileToDebug, column: 1, line: 16 };
103103
await debugClient.setBreakpointsRequest({
104104
lines: [breakpointLocation.line],
105105
breakpoints: [{ line: breakpointLocation.line, column: breakpointLocation.column }],

0 commit comments

Comments
 (0)