@@ -16,6 +16,13 @@ import { reportError } from "./errorReporter";
16
16
import config from "./config" ;
17
17
import { filesDiagnostics , projectsFiles } from "./projectFiles" ;
18
18
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
+
19
26
let tempFilePrefix = "rescript_format_file_" + process . pid + "_" ;
20
27
let tempFileId = 0 ;
21
28
@@ -92,19 +99,19 @@ export let findBinary = (
92
99
93
100
type execResult =
94
101
| {
95
- kind : "success" ;
96
- result : string ;
97
- }
102
+ kind : "success" ;
103
+ result : string ;
104
+ }
98
105
| {
99
- kind : "error" ;
100
- error : string ;
101
- } ;
106
+ kind : "error" ;
107
+ error : string ;
108
+ } ;
102
109
103
110
type formatCodeResult =
104
111
| execResult
105
112
| {
106
- kind : "blocked-using-built-in-formatter" ;
107
- } ;
113
+ kind : "blocked-using-built-in-formatter" ;
114
+ } ;
108
115
109
116
export let formatCode = (
110
117
bscPath : p . DocumentUri | null ,
@@ -265,6 +272,9 @@ export let runAnalysisAfterSanityCheck = (
265
272
266
273
let stdout = "" ;
267
274
try {
275
+ if ( args . includes ( "completion" ) ) {
276
+ sendLogNotification ( p . MessageType . Log , `Running completion: ${ binaryPath } ${ args . join ( " " ) } ` ) ;
277
+ }
268
278
stdout = childProcess . execFileSync ( binaryPath , args , options ) . toString ( ) ;
269
279
return JSON . parse ( stdout ) ;
270
280
} catch ( e ) {
@@ -693,7 +703,7 @@ export let parseCompilerLogOutput = (
693
703
diagnostic,
694
704
diagnosticMessage,
695
705
file,
696
- range,
706
+ range
697
707
} ) ;
698
708
699
709
result [ file ] . push ( diagnostic ) ;
0 commit comments