Skip to content

Commit 190243e

Browse files
committed
Log completion analysis invocations
1 parent 0210fd2 commit 190243e

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

server/src/utils.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ import { reportError } from "./errorReporter";
1616
import config from "./config";
1717
import { 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+
1926
let tempFilePrefix = "rescript_format_file_" + process.pid + "_";
2027
let tempFileId = 0;
2128

@@ -92,19 +99,19 @@ export let findBinary = (
9299

93100
type 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

103110
type formatCodeResult =
104111
| execResult
105112
| {
106-
kind: "blocked-using-built-in-formatter";
107-
};
113+
kind: "blocked-using-built-in-formatter";
114+
};
108115

109116
export 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

Comments
 (0)