Skip to content

Commit fc42d40

Browse files
committed
fix #686
1 parent 94e80c2 commit fc42d40

File tree

3 files changed

+31
-24
lines changed

3 files changed

+31
-24
lines changed

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@
283283
"program": "$${{file}}",
284284
"cwd": "$${{workspaceRoot}}",
285285
"env": null,
286-
"envFile": null,
286+
"envFile": "$${{workspaceRoot}}/.env",
287287
"debugOptions": [
288288
"WaitOnAbnormalExit",
289289
"WaitOnNormalExit",
@@ -311,7 +311,7 @@
311311
"program": "$${{file}}",
312312
"cwd": "$${{workspaceRoot}}",
313313
"env": null,
314-
"envFile": null,
314+
"envFile": "$${{workspaceRoot}}/.env",
315315
"debugOptions": [
316316
"WaitOnAbnormalExit",
317317
"WaitOnNormalExit",
@@ -331,7 +331,7 @@
331331
"module": "module.name",
332332
"cwd": "$${{workspaceRoot}}",
333333
"env": null,
334-
"envFile": null,
334+
"envFile": "$${{workspaceRoot}}/.env",
335335
"debugOptions": [
336336
"WaitOnAbnormalExit",
337337
"WaitOnNormalExit",
@@ -352,7 +352,7 @@
352352
"cwd": "null",
353353
"console": "integratedTerminal",
354354
"env": null,
355-
"envFile": null,
355+
"envFile": "$${{workspaceRoot}}/.env",
356356
"debugOptions": [
357357
"WaitOnAbnormalExit",
358358
"WaitOnNormalExit"
@@ -372,7 +372,7 @@
372372
"cwd": "null",
373373
"console": "externalTerminal",
374374
"env": null,
375-
"envFile": null,
375+
"envFile": "$${{workspaceRoot}}/.env",
376376
"debugOptions": [
377377
"WaitOnAbnormalExit",
378378
"WaitOnNormalExit"
@@ -395,7 +395,7 @@
395395
"--noreload"
396396
],
397397
"env": null,
398-
"envFile": null,
398+
"envFile": "$${{workspaceRoot}}/.env",
399399
"debugOptions": [
400400
"WaitOnAbnormalExit",
401401
"WaitOnNormalExit",
@@ -423,7 +423,7 @@
423423
"--no-debugger",
424424
"--no-reload"
425425
],
426-
"envFile": null,
426+
"envFile": "$${{workspaceRoot}}/.env",
427427
"debugOptions": [
428428
"WaitOnAbnormalExit",
429429
"WaitOnNormalExit",
@@ -444,7 +444,7 @@
444444
"cwd": "$${{workspaceRoot}}",
445445
"args": [],
446446
"env": null,
447-
"envFile": null,
447+
"envFile": "$${{workspaceRoot}}/.env",
448448
"debugOptions": [
449449
"WaitOnAbnormalExit",
450450
"WaitOnNormalExit",
@@ -469,7 +469,7 @@
469469
"--noreload=True"
470470
],
471471
"env": null,
472-
"envFile": null,
472+
"envFile": "$${{workspaceRoot}}/.env",
473473
"debugOptions": [
474474
"WaitOnAbnormalExit",
475475
"WaitOnNormalExit",
@@ -651,7 +651,7 @@
651651
"program": "${file}",
652652
"cwd": "${workspaceRoot}",
653653
"env": null,
654-
"envFile": null,
654+
"envFile": "${workspaceRoot}/.env",
655655
"debugOptions": [
656656
"WaitOnAbnormalExit",
657657
"WaitOnNormalExit",
@@ -675,7 +675,7 @@
675675
"program": "${file}",
676676
"cwd": "${workspaceRoot}",
677677
"env": null,
678-
"envFile": null,
678+
"envFile": "${workspaceRoot}/.env",
679679
"debugOptions": [
680680
"WaitOnAbnormalExit",
681681
"WaitOnNormalExit",
@@ -691,7 +691,7 @@
691691
"module": "module.name",
692692
"cwd": "${workspaceRoot}",
693693
"env": null,
694-
"envFile": null,
694+
"envFile": "${workspaceRoot}/.env",
695695
"debugOptions": [
696696
"WaitOnAbnormalExit",
697697
"WaitOnNormalExit",
@@ -708,7 +708,7 @@
708708
"cwd": "null",
709709
"console": "integratedTerminal",
710710
"env": null,
711-
"envFile": null,
711+
"envFile": "${workspaceRoot}/.env",
712712
"debugOptions": [
713713
"WaitOnAbnormalExit",
714714
"WaitOnNormalExit"
@@ -724,7 +724,7 @@
724724
"cwd": "null",
725725
"console": "externalTerminal",
726726
"env": null,
727-
"envFile": null,
727+
"envFile": "${workspaceRoot}/.env",
728728
"debugOptions": [
729729
"WaitOnAbnormalExit",
730730
"WaitOnNormalExit"
@@ -743,7 +743,7 @@
743743
"--noreload"
744744
],
745745
"env": null,
746-
"envFile": null,
746+
"envFile": "${workspaceRoot}/.env",
747747
"debugOptions": [
748748
"WaitOnAbnormalExit",
749749
"WaitOnNormalExit",
@@ -767,7 +767,7 @@
767767
"--no-debugger",
768768
"--no-reload"
769769
],
770-
"envFile": null,
770+
"envFile": "${workspaceRoot}/.env",
771771
"debugOptions": [
772772
"WaitOnAbnormalExit",
773773
"WaitOnNormalExit",
@@ -784,7 +784,7 @@
784784
"cwd": "${workspaceRoot}",
785785
"args": [],
786786
"env": null,
787-
"envFile": null,
787+
"envFile": "${workspaceRoot}/.env",
788788
"debugOptions": [
789789
"WaitOnAbnormalExit",
790790
"WaitOnNormalExit",
@@ -805,7 +805,7 @@
805805
"--noreload=True"
806806
],
807807
"env": null,
808-
"envFile": null,
808+
"envFile": "${workspaceRoot}/.env",
809809
"debugOptions": [
810810
"WaitOnAbnormalExit",
811811
"WaitOnNormalExit",
@@ -836,7 +836,7 @@
836836
"python.envFile": {
837837
"type": "string",
838838
"description": "Absolute path to a file containing environment variable definitions.",
839-
"default": null
839+
"default": "${workspaceRoot}/.env}"
840840
},
841841
"python.jediPath": {
842842
"type": "string",

src/client/common/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,10 @@ export function getCustomEnvVars(): any {
281281
fs.existsSync(envFile)) {
282282

283283
try {
284-
return parseEnvFile(envFile);
284+
let vars = parseEnvFile(envFile);
285+
if (vars && typeof vars === 'object' && Object.keys(vars).length > 0) {
286+
return vars;
287+
}
285288
}
286289
catch (ex) {
287290
console.error('Failed to load env file');

src/client/debugger/Common/Utils.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,19 @@ export function getCustomEnvVars(envVars: any, envFile: string): any {
131131
console.error(ex);
132132
}
133133
}
134-
134+
let configVars = null;
135135
if (envVars && envFileVars) {
136-
return mergeEnvVariables(envVars, envFileVars);
136+
configVars = mergeEnvVariables(envVars, envFileVars);
137137
}
138138
if (envVars) {
139-
return envVars;
139+
configVars = envVars;
140140
}
141141
if (envFileVars) {
142-
return envFileVars;
142+
configVars = envFileVars;
143+
}
144+
if (configVars && typeof configVars === 'object' && Object.keys(configVars).length > 0) {
145+
return configVars;
143146
}
147+
144148
return null;
145149
}

0 commit comments

Comments
 (0)