Skip to content

Commit

Permalink
fix: bigint previews not working in certain cases (#1278)
Browse files Browse the repository at this point in the history
Fixes #1277
  • Loading branch information
connor4312 authored May 18, 2022
1 parent c07c194 commit 98b20c3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he
### Nightly (only)

- chore: support new sha script hashes from chrome ([#1244](https://github.com/microsoft/vscode-js-debug/issues/1244))
- fix: bigint value previews not working in some cases ([#1277](https://github.com/microsoft/vscode-js-debug/issues/1277))
- fix: snap versions in alternate install locations resulting in warning ([#1239](https://github.com/microsoft/vscode-js-debug/issues/1239))
- fix: align hoverEvaluation config suggestion with actual default
- fix: remove query strings from sourcemapped URLs ([#1225](https://github.com/microsoft/vscode-js-debug/issues/1225))
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/objectPreview/betterTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export type SpecialNumberPreview = TSpecialNumber;
export type TBigint = {
type: 'bigint';
subtype: undefined;
unserializableValue: string;
unserializableValue?: string;
description: string;
};
export type BigintPreview = TBigint;
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/objectPreview/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ function formatAsNumber(

if (param.type === 'bigint') {
// parse unserializableValue is "1234n", slice the "n" off to parse and then base16 the number
const v = param.unserializableValue;
const v = param.unserializableValue || param.description;
return format?.hex ? BigInt(v.slice(0, -1)).toString(16) : v;
}

Expand Down
4 changes: 4 additions & 0 deletions src/test/evaluate/evaluate-supports-bigint-map-keys-1277.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
> result: Map(2) {size: 2, 1n => one, 2n => two}
size: 2
> [[Entries]]: Array(2)
> [[Prototype]]: Map
6 changes: 6 additions & 0 deletions src/test/evaluate/evaluate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,4 +494,10 @@ describe('evaluate', () => {
await evaluateAtReturn('undefined');
r.assertLog();
});

itIntegrates('supports bigint map keys (#1277)', async ({ r }) => {
const p = await r.launchUrlAndLoad('index.html');
await p.logger.evaluateAndLog(`new Map([[1n, 'one'], [2n, 'two']])`);
r.assertLog();
});
});

0 comments on commit 98b20c3

Please sign in to comment.