Skip to content

Commit

Permalink
fix: path diff display in diagnostic tool
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 committed Nov 1, 2023
1 parent ca624e1 commit c4f51b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he

- fix: reuse the webassembly worker across sessions in the debug tree ([#1830](https://github.com/microsoft/vscode-js-debug/issues/1830))
- fix: respect sourceMapResolveLocations in the web extension host ([vscode#196781](https://github.com/microsoft/vscode/issues/196781))
- fix: path diff display in diagnostic tool ([vscode#195891](https://github.com/microsoft/vscode/issues/195891))

## v1.84 (October 2023)

Expand Down
15 changes: 9 additions & 6 deletions src/diagnosticTool/breakpointHelper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/

import { diffChars } from 'diff';
import { diffArrays } from 'diff';
import { Fragment, FunctionComponent, h } from 'preact';
import { useState } from 'preact/hooks';
import {
Expand Down Expand Up @@ -217,11 +217,14 @@ const TextDiff: FunctionComponent<{ original: string; updated: string }> = ({
updated,
}) => (
<span className="text-diff">
{diffChars(original, updated, { ignoreCase: true }).map((diff, i) => (
<span className={diff.added ? 'add' : diff.removed ? 'rm' : ''} key={i}>
{diff.value}
</span>
))}
{diffArrays(original.split(/[/\\]/g), updated.split(/[/\\]/g), { ignoreCase: true }).map(
(diff, i) => (
<span className={diff.added ? 'add' : diff.removed ? 'rm' : ''} key={i}>
{i > 0 ? '/' : ''}
{diff.value.join('/')}
</span>
),
)}
</span>
);

Expand Down

0 comments on commit c4f51b9

Please sign in to comment.