From ff03fc00d3057b6794470b1adda8bb14cdfd80f3 Mon Sep 17 00:00:00 2001 From: "Brandon Waterloo [MSFT]" <36966225+bwateratmsft@users.noreply.github.com> Date: Wed, 20 Jan 2021 12:48:34 -0500 Subject: [PATCH] Use localhost debugAdapterHost for WSL (#2650) --- src/debugging/python/PythonDebugHelper.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/debugging/python/PythonDebugHelper.ts b/src/debugging/python/PythonDebugHelper.ts index dc26d75286..32bff26d04 100644 --- a/src/debugging/python/PythonDebugHelper.ts +++ b/src/debugging/python/PythonDebugHelper.ts @@ -7,6 +7,7 @@ import * as path from 'path'; import { ext } from '../../extensionVariables'; import { PythonExtensionHelper } from '../../tasks/python/PythonExtensionHelper'; import { PythonRunTaskDefinition } from '../../tasks/python/PythonTaskHelper'; +import { getVSCodeRemoteInfo, RemoteKind } from '../../utils/getVSCodeRemoteInfo'; import { isLinux } from '../../utils/osUtils'; import { PythonProjectType } from '../../utils/pythonUtils'; import { DebugHelper, DockerDebugContext, DockerDebugScaffoldContext, inferContainerName, ResolvedDebugConfiguration, resolveDockerServerReadyAction } from '../DebugHelper'; @@ -133,9 +134,9 @@ export class PythonDebugHelper implements DebugHelper { } private async getDebugAdapterHost(context: DockerDebugContext): Promise { - // For Windows and Mac, we ask debugpy to listen on localhost:{randomPort} and then + // For Windows, Mac, and WSL, we ask debugpy to listen on localhost:{randomPort} and then // we use 'host.docker.internal' in the launcher to get the host's ip address. - if (!isLinux()) { + if (!isLinux() || getVSCodeRemoteInfo(context.actionContext).remoteKind === RemoteKind.wsl) { return 'localhost'; }