diff --git a/packages/debug/package.json b/packages/debug/package.json index a7fafa9b8aea8..910f4ac0cdc5b 100644 --- a/packages/debug/package.json +++ b/packages/debug/package.json @@ -17,6 +17,7 @@ "@theia/variable-resolver": "1.34.0", "@theia/workspace": "1.34.0", "@vscode/debugprotocol": "^1.51.0", + "fast-deep-equal": "^3.1.3", "jsonc-parser": "^2.2.0", "p-debounce": "^2.1.0" }, diff --git a/packages/debug/src/browser/breakpoint/breakpoint-manager.ts b/packages/debug/src/browser/breakpoint/breakpoint-manager.ts index 8a02b5963630d..e45ed10ab17c6 100644 --- a/packages/debug/src/browser/breakpoint/breakpoint-manager.ts +++ b/packages/debug/src/browser/breakpoint/breakpoint-manager.ts @@ -19,6 +19,7 @@ import { Emitter } from '@theia/core/lib/common'; import { StorageService } from '@theia/core/lib/browser'; import { Marker } from '@theia/markers/lib/common/marker'; import { MarkerManager } from '@theia/markers/lib/browser/marker-manager'; +import * as deepEqual from 'fast-deep-equal'; import URI from '@theia/core/lib/common/uri'; import { SourceBreakpoint, BREAKPOINT_KIND, ExceptionBreakpoint, FunctionBreakpoint, BaseBreakpoint, InstructionBreakpoint } from './breakpoint-marker'; @@ -64,24 +65,15 @@ export class BreakpointManager extends MarkerManager { const added: SourceBreakpoint[] = []; const removed: SourceBreakpoint[] = []; const changed: SourceBreakpoint[] = []; - const oldMarkers = new Map(result.map(({ data }) => [data.id, data] as [string, SourceBreakpoint])); + const oldMarkers = new Map(result.map(({ data }) => [data.id, data])); const ids = new Set(); for (const newMarker of newMarkers) { ids.add(newMarker.id); const oldMarker = oldMarkers.get(newMarker.id); if (!oldMarker) { added.push(newMarker); - // @ts-ignore - } else { - const oldRawKeys = Object.keys(oldMarker.raw); - const newRawKeys = Object.keys(newMarker.raw); - if ( - newRawKeys.length !== oldRawKeys.length - || newRawKeys.some((key: keyof SourceBreakpoint['raw']) => newMarker.raw[key] !== oldMarker.raw[key]) - || Object.keys(newMarker).some((key: keyof SourceBreakpoint) => key !== 'raw' && newMarker[key] !== oldMarker[key]) - ) { - changed.push(newMarker); - } + } else if (!deepEqual(oldMarker, newMarker)) { + changed.push(newMarker); } } for (const [id, data] of oldMarkers.entries()) {