Skip to content

Commit

Permalink
Revert "Fix for issue #11396 (#11436)"
Browse files Browse the repository at this point in the history
This reverts commit 0271863.
  • Loading branch information
roblourens committed Oct 5, 2022
1 parent 48fa7d5 commit 3e6d120
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 50 deletions.
2 changes: 0 additions & 2 deletions news/2 Fixes/11396.md

This file was deleted.

8 changes: 3 additions & 5 deletions src/interactive-window/debugger/jupyter/kernelDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ export class KernelDebugAdapter extends KernelDebugAdapterBase {
}
try {
const code = (metadata.generatedCode?.code || cell.document.getText()).replace(/\r\n/g, '\n');
const response = (await this.session.customRequest('dumpCell', { code })) as IDumpCellResponse;
const response = await this.session.customRequest('dumpCell', { code });

// We know jupyter will strip out leading white spaces, hence take that into account.
const norm = KernelDebugAdapterBase.normalizeFsAware(response.sourcePath);
const norm = path.normalize((response as IDumpCellResponse).sourcePath);
this.fileToCell.set(norm, Uri.parse(metadata.interactive.uristring));

// If this cell doesn't have a cell marker, then
Expand Down Expand Up @@ -131,10 +131,8 @@ export class KernelDebugAdapter extends KernelDebugAdapterBase {
if (!cell) {
return;
}

source.name = path.basename(cell.interactiveWindow.path);
source.path = cell.interactiveWindow.path;

source.path = cell.interactiveWindow.toString();
if (typeof lines?.endLine === 'number') {
lines.endLine = lines.endLine + (cell.lineOffset || 0);
}
Expand Down
9 changes: 5 additions & 4 deletions src/notebooks/debugger/kernelDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

'use strict';

import * as path from '../../platform/vscode-path/path';
import { IDumpCellResponse } from './debuggingTypes';
import { traceError } from '../../platform/logging';
import { KernelDebugAdapterBase } from './kernelDebugAdapterBase';
import { DebugProtocol } from 'vscode-debugprotocol';
import { IDumpCellResponse } from './debuggingTypes';

/**
* Concrete implementation of the KernelDebugAdapterBase class that will dump cells
Expand All @@ -18,10 +19,10 @@ export class KernelDebugAdapter extends KernelDebugAdapterBase {
protected override async dumpCell(index: number): Promise<void> {
const cell = this.notebookDocument.cellAt(index);
try {
const response = (await this.session.customRequest('dumpCell', {
const response = await this.session.customRequest('dumpCell', {
code: cell.document.getText().replace(/\r\n/g, '\n')
})) as IDumpCellResponse;
const norm = KernelDebugAdapterBase.normalizeFsAware(response.sourcePath);
});
const norm = path.normalize((response as IDumpCellResponse).sourcePath);
this.fileToCell.set(norm, cell.document.uri);
this.cellToFile.set(cell.document.uri.toString(), norm);
} catch (err) {
Expand Down
12 changes: 0 additions & 12 deletions src/notebooks/debugger/kernelDebugAdapterBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,6 @@ export abstract class KernelDebugAdapterBase implements DebugAdapter, IKernelDeb
});
}

static normalizeFsAware(sourcePath: string) {
// If the kernel runs on Windows, then do windows-style path normalization
// (see https://github.com/ipython/ipykernel/issues/995).
let norm = '';
if (sourcePath.match(/^[A-Za-z]:/)) {
norm = path.win32.normalize(sourcePath);
} else {
norm = sourcePath;
}
return norm;
}

private lookupCellByLongName(sourcePath: string) {
if (!this.platformService.isWindows) {
return undefined;
Expand Down
27 changes: 0 additions & 27 deletions src/test/debugger/jupyter/kernelDebugAdapter.unit.test.ts

This file was deleted.

0 comments on commit 3e6d120

Please sign in to comment.