-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REF] vscode: debug client restart after removing python extension
- Loading branch information
Showing
1 changed file
with
12 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -718,6 +718,7 @@ async function checkStandalonePythonVersion(context: ExtensionContext): Promise< | |
const pythonPath = currentConfig["pythonPath"] | ||
if (!pythonPath) { | ||
OUTPUT_CHANNEL.appendLine("[INFO] pythonPath is not set, defaulting to python3."); | ||
//handle faalback correctly | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Louciole
Author
Member
|
||
} | ||
|
||
const versionString = execSync(`${pythonPath} --version`).toString().replace("Python ", "") | ||
|
@@ -742,21 +743,27 @@ async function checkStandalonePythonVersion(context: ExtensionContext): Promise< | |
|
||
async function getPythonPath(context): Promise<string>{ | ||
let pythonPath: string; | ||
let interpreter: IInterpreterDetails; | ||
const config = await getCurrentConfig(context) | ||
try{ | ||
//trying to use the VScode python extension | ||
const interpreter = await getInterpreterDetails(); | ||
try { | ||
interpreter = await getInterpreterDetails(); | ||
} catch { | ||
interpreter = null; | ||
} | ||
|
||
//trying to use the VScode python extension | ||
if (interpreter && global.IS_PYTHON_EXTENSION_READY !== false) { | ||
config ? pythonPath = interpreter.path[0] : pythonPath = null; | ||
global.IS_PYTHON_EXTENSION_READY = true; | ||
|
||
}catch{ | ||
} else { | ||
global.IS_PYTHON_EXTENSION_READY = false; | ||
//python extension is not available switch to standalone mode | ||
if (config){ | ||
pythonPath = await getStandalonePythonPath(context); | ||
await checkStandalonePythonVersion(context); | ||
} | ||
} | ||
|
||
global.OUTPUT_CHANNEL.appendLine("[INFO] Python VS code extension is ".concat(global.IS_PYTHON_EXTENSION_READY ? "ready" : "not ready")); | ||
return pythonPath | ||
} |
faalback ? 😄