Skip to content

Commit

Permalink
Fix for issue microsoft#11396
Browse files Browse the repository at this point in the history
* During notebook cell debugging, apply path normalization on the path of the dumped tmp file only if the kernel runs on a Windows machine.
  • Loading branch information
Ádám Zlatniczki committed Sep 23, 2022
1 parent 06ca869 commit 998fbac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions news/2 Fixes/11396.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed a bug that introduced a cross-OS interworking issue, making the notebook cell debugger skip breakpoints when VSCode is run on Windows but the kernel is run on Unix
(thanks [Adam Zlatniczki](https://github.com/adam-zlatniczki))
13 changes: 12 additions & 1 deletion src/notebooks/debugger/kernelDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,18 @@ export class KernelDebugAdapter extends KernelDebugAdapterBase {
const response = await this.session.customRequest('dumpCell', {
code: cell.document.getText().replace(/\r\n/g, '\n')
});
const norm = path.normalize((response as IDumpCellResponse).sourcePath);

// Based on the response, check if the kernel runs on a Unix or Windows machine.
// If it runs on Windows, then path normalization might be necessary
// (see https://github.com/ipython/ipykernel/issues/995).
const dumpFilePathOnKernelSide = (response as IDumpCellResponse).sourcePath;
var norm = '';
if (dumpFilePathOnKernelSide.match('[A-Za-z]:.*')) {
norm = path.normalize(dumpFilePathOnKernelSide);
} else {
norm = dumpFilePathOnKernelSide;
}

this.fileToCell.set(norm, cell.document.uri);
this.cellToFile.set(cell.document.uri.toString(), norm);
} catch (err) {
Expand Down

0 comments on commit 998fbac

Please sign in to comment.