Skip to content

Commit fb09506

Browse files
normalize the path
1 parent f3d89d2 commit fb09506

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/extension.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ export function activate(context: vscode.ExtensionContext) {
4646
// Step 3: Read and parse the JSON
4747
const raw = await fs.promises.readFile(jsonPath, 'utf8');
4848
const parsed = JSON.parse(raw) as any;
49-
const records: Record<string, Array<[number, number, number]>> = parsed.records ?? {};
49+
const records = Object.fromEntries(
50+
Object.entries(parsed.records ?? {}).map(([k, v]) => [path.normalize(k), v as [number, number, number][]])
51+
) as Record<string, [number, number, number][]>;
5052
const clocksPerSec: number = typeof parsed.CLOCKS_PER_SEC === 'number' && isFinite(parsed.CLOCKS_PER_SEC)
5153
? parsed.CLOCKS_PER_SEC
5254
: 1_000_000; // default to microsecond resolution if absent
@@ -336,8 +338,7 @@ class LineProfilerDecorator implements vscode.Disposable {
336338

337339
private async applyToEditor(editor: vscode.TextEditor): Promise<void> {
338340
const relPath = path
339-
.relative(this.sourceRoot, editor.document.uri.fsPath)
340-
.replace(/\\+/g, '/');
341+
.normalize(path.relative(this.sourceRoot, editor.document.uri.fsPath))
341342
const records = this.data[relPath];
342343
if (!records || records.length === 0) {
343344
editor.setDecorations(this.prefixDecorationType, []);

0 commit comments

Comments
 (0)