@@ -16,6 +16,13 @@ import { reportError } from "./errorReporter";
1616import config from "./config" ;
1717import { filesDiagnostics , projectsFiles } from "./projectFiles" ;
1818
19+ // This is a bit dirty but avoids passing down this function each time.
20+ export type SendLogNotification = ( level : p . MessageType , message : string ) => void
21+ let sendLogNotification : SendLogNotification = ( ) => { } ;
22+ export function setSendLogNotification ( send : SendLogNotification ) {
23+ sendLogNotification = send ;
24+ }
25+
1926let tempFilePrefix = "rescript_format_file_" + process . pid + "_" ;
2027let tempFileId = 0 ;
2128
@@ -92,19 +99,19 @@ export let findBinary = (
9299
93100type execResult =
94101 | {
95- kind : "success" ;
96- result : string ;
97- }
102+ kind : "success" ;
103+ result : string ;
104+ }
98105 | {
99- kind : "error" ;
100- error : string ;
101- } ;
106+ kind : "error" ;
107+ error : string ;
108+ } ;
102109
103110type formatCodeResult =
104111 | execResult
105112 | {
106- kind : "blocked-using-built-in-formatter" ;
107- } ;
113+ kind : "blocked-using-built-in-formatter" ;
114+ } ;
108115
109116export let formatCode = (
110117 bscPath : p . DocumentUri | null ,
@@ -265,6 +272,9 @@ export let runAnalysisAfterSanityCheck = (
265272
266273 let stdout = "" ;
267274 try {
275+ if ( args . includes ( "completion" ) ) {
276+ sendLogNotification ( p . MessageType . Log , `Running completion: ${ binaryPath } ${ args . join ( " " ) } ` ) ;
277+ }
268278 stdout = childProcess . execFileSync ( binaryPath , args , options ) . toString ( ) ;
269279 return JSON . parse ( stdout ) ;
270280 } catch ( e ) {
@@ -693,7 +703,7 @@ export let parseCompilerLogOutput = (
693703 diagnostic,
694704 diagnosticMessage,
695705 file,
696- range,
706+ range
697707 } ) ;
698708
699709 result [ file ] . push ( diagnostic ) ;
0 commit comments