|
8 | 8 | DebugSessionOptions, |
9 | 9 | Disposable, |
10 | 10 | GlobalEnvironmentVariableCollection, |
| 11 | + env, |
11 | 12 | l10n, |
12 | 13 | RelativePattern, |
13 | 14 | workspace, |
@@ -49,13 +50,15 @@ export async function registerNoConfigDebug( |
49 | 50 | return Promise.resolve(new Disposable(() => {})); |
50 | 51 | } |
51 | 52 |
|
52 | | - // create a stable hash for the workspace folder, reduce terminal variable churn |
| 53 | + // Create unique hash based on workspace and VS Code session ID |
53 | 54 | const hash = crypto.createHash('sha256'); |
54 | 55 | hash.update(workspaceString.toString()); |
| 56 | + hash.update(env.sessionId); |
55 | 57 | const stableWorkspaceHash = hash.digest('hex').slice(0, 16); |
56 | 58 |
|
57 | 59 | const tempDirPath = path.join(extPath, '.noConfigDebugAdapterEndpoints'); |
58 | | - const tempFilePath = path.join(tempDirPath, `endpoint-${stableWorkspaceHash}.txt`); |
| 60 | + const endpointFilename = `endpoint-${stableWorkspaceHash}.txt`; |
| 61 | + const tempFilePath = path.join(tempDirPath, endpointFilename); |
59 | 62 |
|
60 | 63 | // create the temp directory if it doesn't exist |
61 | 64 | if (!fs.existsSync(tempDirPath)) { |
@@ -92,8 +95,8 @@ export async function registerNoConfigDebug( |
92 | 95 | 'Enables use of [no-config debugging](https://github.com/microsoft/vscode-python-debugger/wiki/No%E2%80%90Config-Debugging), `debugpy <script.py>`, in the terminal.', |
93 | 96 | ); |
94 | 97 |
|
95 | | - // create file system watcher for the debuggerAdapterEndpointFolder for when the communication port is written |
96 | | - const fileSystemWatcher = createFileSystemWatcher(new RelativePattern(tempDirPath, '**/*.txt')); |
| 98 | + // create file system watcher for the debugger adapter endpoint for when the communication port is written |
| 99 | + const fileSystemWatcher = createFileSystemWatcher(new RelativePattern(tempDirPath, endpointFilename)); |
97 | 100 | const fileCreationEvent = fileSystemWatcher.onDidCreate(async (uri) => { |
98 | 101 | sendTelemetryEvent(EventName.DEBUG_SESSION_START, undefined, { |
99 | 102 | trigger: 'noConfig' as TriggerType, |
|
0 commit comments