Skip to content

Commit

Permalink
Use localhost debugAdapterHost for WSL (#2650)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwateratmsft authored Jan 20, 2021
1 parent 8facf53 commit 1542c8f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/debugging/python/PythonDebugHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -133,9 +134,9 @@ export class PythonDebugHelper implements DebugHelper {
}

private async getDebugAdapterHost(context: DockerDebugContext): Promise<string> {
// 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';
}

Expand Down

0 comments on commit 1542c8f

Please sign in to comment.