Skip to content

Commit

Permalink
[REF] vscode: debug client restart after removing python extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Louciole committed Jan 3, 2024
1 parent e4741b3 commit 842e676
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions vscode/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Copy link
@delvsola

delvsola Jan 3, 2024

Contributor

faalback ? 😄

This comment has been minimized.

Copy link
@Louciole

Louciole Jan 3, 2024

Author Member

I'm currently working on it, I was not supposed to push this as it is 😅

}

const versionString = execSync(`${pythonPath} --version`).toString().replace("Python ", "")
Expand All @@ -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
}

0 comments on commit 842e676

Please sign in to comment.