Skip to content
This repository was archived by the owner on Apr 24, 2021. It is now read-only.

Commit 535d502

Browse files
committed
Don't create a log file by default.
Fixes rescript-lang/rescript-vscode#47.
1 parent 385ac8b commit 535d502

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

Changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## master
22
- Fix issue where type variables are printed with global renaming when hovering or autocompleting a module (see https://github.com/rescript-lang/rescript-editor-support/issues/38).
3+
- Fix issue where a log file was always created (see https://github.com/rescript-lang/rescript-vscode/issues/47).
34

45
## Release 1.0.1 of rescript-vscode
56
This [commit](https://github.com/rescript-lang/rescript-editor-support/commit/232ad609766c415048750c5cc828973a9995f382) is vendored in [rescript-vscode 1.0.1](https://github.com/rescript-lang/rescript-vscode/releases/tag/1.0.1).

src/rescript-editor-support/Log.re

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
let out = ref(None);
22

33
let initial_dest = Filename.concat(Filename.get_temp_dir_name(), "lsp.log");
4-
out := Some(open_out(initial_dest));
54

6-
let setLocation = (location) => {
7-
switch out^ {
5+
let setLocation = location => {
6+
switch (out^) {
87
| None => ()
98
| Some(out) => close_out(out)
109
};
1110
output_string(stderr, "Setting log location: " ++ location ++ "\n");
1211
flush(stderr);
13-
out := Some(open_out(location))
12+
out := Some(open_out(location));
1413
};
1514

1615
let spamError = ref(false);
1716

18-
let log = (msg) =>
19-
switch out^ {
17+
let log = msg => {
18+
if (spamError^) {
19+
output_string(stderr, msg ++ "\n");
20+
flush(stderr);
21+
};
22+
switch (out^) {
2023
| None => ()
2124
| Some(out) =>
2225
output_string(out, msg ++ "\n");
23-
if (spamError^) {
24-
output_string(stderr, msg ++ "\n");
25-
flush(stderr)
26-
};
27-
flush(out)
28-
};
26+
flush(out);
27+
};
28+
};

0 commit comments

Comments
 (0)