1
1
/* eslint-disable @typescript-eslint/no-explicit-any */
2
2
import * as fs from 'fs' ;
3
- import JSONBigConfig from 'json-bigint' ;
4
3
import * as path from 'path' ;
5
4
import { ItemPropertiesSignalPayload } from 'traceviewer-base/lib/signals/item-properties-signal-payload' ;
6
5
import { signalManager } from 'traceviewer-base/lib/signals/signal-manager' ;
7
6
import { TimeRangeUpdatePayload } from 'traceviewer-base/lib/signals/time-range-data-signal-payloads' ;
8
- import { Experiment } from 'tsp-typescript-client/lib/models/experiment' ;
9
- import { MarkerSet } from 'tsp-typescript-client/lib/models/markerset' ;
10
- import { OutputDescriptor } from 'tsp-typescript-client/lib/models/output-descriptor' ;
11
7
import * as vscode from 'vscode' ;
12
8
import type { Messenger } from 'vscode-messenger' ;
13
9
import { NotificationType , WebviewIdMessageParticipant } from 'vscode-messenger-common' ;
@@ -42,16 +38,15 @@ import {
42
38
updateMarkerCategoryState ,
43
39
updateMarkerSetState
44
40
} from 'vscode-trace-common/lib/messages/vscode-messages' ;
45
- import { convertSignalExperiment } from 'vscode-trace-common/lib/signals/vscode-signal-converter' ;
41
+ import { Experiment } from 'tsp-typescript-client/lib/models/experiment' ;
42
+ import { MarkerSet } from 'tsp-typescript-client/lib/models/markerset' ;
43
+ import { OutputDescriptor } from 'tsp-typescript-client/lib/models/output-descriptor' ;
44
+ import { JSONBigUtils } from 'tsp-typescript-client/lib/utils/jsonbig-utils' ;
46
45
import { handleRemoveMessage , handleStatusMessage , setStatusFromPanel } from '../common/trace-message' ;
47
46
import { traceExtensionWebviewManager } from '../extension' ;
48
47
import { ClientType , getTraceServerUrl , getTspClientUrl } from '../utils/backend-tsp-client-provider' ;
49
48
import { TraceServerConnectionStatusService } from '../utils/trace-server-status' ;
50
49
51
- const JSONBig = JSONBigConfig ( {
52
- useNativeBigInt : true
53
- } ) ;
54
-
55
50
interface QuickPickItem extends vscode . QuickPickItem {
56
51
id : string ;
57
52
}
@@ -415,7 +410,7 @@ export class TraceViewerPanel {
415
410
416
411
protected doHandleExperimentSelectedSignal ( experiment : Experiment | undefined ) : void {
417
412
if ( this . _experiment && experiment && this . _experiment . UUID === experiment . UUID ) {
418
- const wrapper : string = JSONBig . stringify ( experiment ) ;
413
+ const wrapper = JSONBigUtils . stringify ( experiment ) ;
419
414
const data = { wrapper } ;
420
415
this . _messenger . sendNotification ( experimentSelected , this . _webviewParticipant , data ) ;
421
416
}
@@ -426,19 +421,19 @@ export class TraceViewerPanel {
426
421
}
427
422
428
423
protected doHandleRequestSelectionRangeChange ( payload : TimeRangeUpdatePayload ) : void {
429
- this . _messenger . sendNotification ( experimentSelected , this . _webviewParticipant , JSONBig . stringify ( payload ) ) ;
424
+ this . _messenger . sendNotification ( experimentSelected , this . _webviewParticipant , JSONBigUtils . stringify ( payload ) ) ;
430
425
}
431
426
setExperiment ( experiment : Experiment ) : void {
432
427
this . _experiment = experiment ;
433
- const wrapper : string = JSONBig . stringify ( experiment ) ;
428
+ const wrapper = JSONBigUtils . stringify ( experiment ) ;
434
429
const data = { wrapper } ;
435
430
this . _messenger . sendNotification ( setExperiment , this . _webviewParticipant , data ) ;
436
431
signalManager ( ) . emit ( 'EXPERIMENT_OPENED' , experiment ) ;
437
432
signalManager ( ) . emit ( 'TRACEVIEWERTAB_ACTIVATED' , experiment ) ;
438
433
}
439
434
440
435
addOutput ( descriptor : OutputDescriptor ) : void {
441
- const wrapper : string = JSONBig . stringify ( descriptor ) ;
436
+ const wrapper = JSONBigUtils . stringify ( descriptor ) ;
442
437
const data = { wrapper } ;
443
438
this . _messenger . sendNotification ( addOutput , this . _webviewParticipant , data ) ;
444
439
}
@@ -550,7 +545,7 @@ export class TraceViewerPanel {
550
545
private doHandleVscodeWebViewReady ( ) : void {
551
546
// Post the tspTypescriptClient
552
547
if ( this . _experiment ) {
553
- const wrapper : string = JSONBig . stringify ( this . _experiment ) ;
548
+ const wrapper = JSONBigUtils . stringify ( this . _experiment ) ;
554
549
const data = { data : getTspClientUrl ( ClientType . FRONTEND ) , experiment : wrapper } ;
555
550
this . _messenger . sendNotification ( setTspClient , this . _webviewParticipant , data ) ;
556
551
} else {
@@ -628,20 +623,20 @@ export class TraceViewerPanel {
628
623
629
624
private doHandleVscodeViewRangeUpdated ( data : any ) : void {
630
625
if ( data ) {
631
- signalManager ( ) . emit ( 'VIEW_RANGE_UPDATED' , JSONBig . parse ( data ) ) ;
626
+ const result = JSONBigUtils . parse < TimeRangeUpdatePayload > ( data ) ;
627
+ signalManager ( ) . emit ( 'VIEW_RANGE_UPDATED' , result ) ;
632
628
}
633
629
}
634
630
635
631
private doHandleVscodeSelectionRangeUpdated ( data : any ) : void {
636
632
if ( data ) {
637
- signalManager ( ) . emit ( 'SELECTION_RANGE_UPDATED' , JSONBig . parse ( data ) ) ;
633
+ signalManager ( ) . emit ( 'SELECTION_RANGE_UPDATED' , JSONBigUtils . parse < TimeRangeUpdatePayload > ( data ) ) ;
638
634
}
639
635
}
640
636
641
637
private doHandleExperimentUpdated ( data : any ) : void {
642
638
if ( data ) {
643
- const experiment = convertSignalExperiment ( JSONBig . parse ( data ) ) ;
644
- signalManager ( ) . emit ( 'EXPERIMENT_UPDATED' , experiment ) ;
639
+ signalManager ( ) . emit ( 'EXPERIMENT_UPDATED' , JSONBigUtils . parse ( data , Experiment ) ) ;
645
640
}
646
641
}
647
642
0 commit comments