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

Don't create a log file by default. #42

Merged
merged 2 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## master
- 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).
- Fix issue where a log file was always created (see https://github.com/rescript-lang/rescript-vscode/issues/47).

## Release 1.0.1 of rescript-vscode
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).
Expand Down
26 changes: 12 additions & 14 deletions src/rescript-editor-support/Log.re
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
let out = ref(None);

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

let setLocation = (location) => {
switch out^ {
let setLocation = location => {
switch (out^) {
| None => ()
| Some(out) => close_out(out)
};
output_string(stderr, "Setting log location: " ++ location ++ "\n");
flush(stderr);
out := Some(open_out(location))
out := Some(open_out(location));
};

let spamError = ref(false);

let log = (msg) =>
switch out^ {
let log = msg => {
if (spamError^) {
output_string(stderr, msg ++ "\n");
flush(stderr);
};
switch (out^) {
| None => ()
| Some(out) =>
output_string(out, msg ++ "\n");
if (spamError^) {
output_string(stderr, msg ++ "\n");
flush(stderr)
};
flush(out)
};
flush(out);
};
};
1 change: 0 additions & 1 deletion src/rescript-editor-support/RescriptEditorSupport.re
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ let getInitialState = params => {
Files.mkdirp(rootPath /+ "node_modules" /+ ".lsp");
Log.setLocation(rootPath /+ "node_modules" /+ ".lsp" /+ "debug.log");
Log.log("Hello - from " ++ Sys.executable_name);
Log.log("Previous log location: " ++ Log.initial_dest);

Rpc.sendNotification(
stdout,
Expand Down