@@ -1485,6 +1485,50 @@ async function onMessage(msg: p.Message) {
1485
1485
if ( extName === c . resExt ) {
1486
1486
send ( await signatureHelp ( msg ) ) ;
1487
1487
}
1488
+ } else if ( msg . method === "rescript/dumpServerState" ) {
1489
+ // Custom debug endpoint: dump current server state (config + projectsFiles)
1490
+ try {
1491
+ const projects = Array . from ( projectsFiles . entries ( ) ) . map (
1492
+ ( [ projectRootPath , pf ] ) => ( {
1493
+ projectRootPath,
1494
+ openFiles : Array . from ( pf . openFiles ) ,
1495
+ filesWithDiagnostics : Array . from ( pf . filesWithDiagnostics ) ,
1496
+ filesDiagnostics : pf . filesDiagnostics ,
1497
+ rescriptVersion : pf . rescriptVersion ,
1498
+ bscBinaryLocation : pf . bscBinaryLocation ,
1499
+ editorAnalysisLocation : pf . editorAnalysisLocation ,
1500
+ namespaceName : pf . namespaceName ,
1501
+ hasPromptedToStartBuild : pf . hasPromptedToStartBuild ,
1502
+ bsbWatcherByEditor :
1503
+ pf . bsbWatcherByEditor != null
1504
+ ? { pid : pf . bsbWatcherByEditor . pid ?? null }
1505
+ : null ,
1506
+ } ) ,
1507
+ ) ;
1508
+
1509
+ const result = {
1510
+ config : config . extensionConfiguration ,
1511
+ projects,
1512
+ workspaceFolders : Array . from ( workspaceFolders ) ,
1513
+ } ;
1514
+
1515
+ let response : p . ResponseMessage = {
1516
+ jsonrpc : c . jsonrpcVersion ,
1517
+ id : msg . id ,
1518
+ result,
1519
+ } ;
1520
+ send ( response ) ;
1521
+ } catch ( e ) {
1522
+ let response : p . ResponseMessage = {
1523
+ jsonrpc : c . jsonrpcVersion ,
1524
+ id : msg . id ,
1525
+ error : {
1526
+ code : p . ErrorCodes . InternalError ,
1527
+ message : `Failed to dump server state: ${ String ( e ) } ` ,
1528
+ } ,
1529
+ } ;
1530
+ send ( response ) ;
1531
+ }
1488
1532
} else {
1489
1533
let response : p . ResponseMessage = {
1490
1534
jsonrpc : c . jsonrpcVersion ,
0 commit comments