No errors shown anymore after clean & rebuild
Steps to reproduce:
- Create a new project with create-rescript-app ("basic" template is sufficient)
- Build the project
- Open the editor
- Introduce an error (e.g. "Console.log" -> "Cnsole.log") => the error is underlined correctly in the editor
- Undo the error
- Clean and rebuild the project, keeping the editor open
- Reintroduce the error => it is not shown in the editor this time
It seems that, when you currently have a ReScript file open in the editor and clean the project, the language server terminates unexpectedly with the following error:
node:fs:605
handleErrorFromBinding(ctx);
^
Error: ENOENT: no such file or directory, open '/Users/christoph/projects/playground/editor-tooling-test/lib/bs/.compiler.log'
at Object.openSync (node:fs:605:3)
at Object.func [as openSync] (node:electron/js2c/node_init:2:2214)
at Object.readFileSync (node:fs:473:35)
at t.readFileSync (node:electron/js2c/node_init:2:9771)
at /Users/christoph/.vscode/extensions/chenglou92.rescript-vscode-1.50.0/server/out/cli.js:42:1359
at Map.forEach (<anonymous>)
at Gv (/Users/christoph/.vscode/extensions/chenglou92.rescript-vscode-1.50.0/server/out/cli.js:42:1284)
at vo.<anonymous> (/Users/christoph/.vscode/extensions/chenglou92.rescript-vscode-1.50.0/server/out/cli.js:42:2538)
at vo.emit (node:events:517:28)
at vo.emitWithAll (/Users/christoph/.vscode/extensions/chenglou92.rescript-vscode-1.50.0/server/out/cli.js:35:25605) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/Users/christoph/projects/playground/editor-tooling-test/lib/bs/.compiler.log'
}
Perfect. thank you!
Just encountered this one as well while doing a rebase on an old feature branch. The only way to work is to click on the links in the compiler output directly for every remaining error and fix the issues without LSP help. After a successful compile, rescript-vscode can be restarted and works again without crashing.
Feels like fixing this should be quite straight forward. @fhammerschmidt want to take a stab at it?
Is that so? Can you give some guidance on how to approach it?
@fhammerschmidt I could be totally wrong of course, but this sounds like a scenario where we're just not cleaning up the state appropriately when the clean/rebuild happens. So, I'd start with tracking the events that happen around cleaning/rebuilding (what happens to the compiler log, are we watching any lock file for bsb, etc), and then try to figure out at which point we should be resetting the state for that project. There's code already that purges the server state when all files of a specific project is closed.
Have a look at it and maybe we can look more together if you can't figure it out?
Sounds good, Ill take a shot.
@jfrolich This was fixed as part of #1033, right?
No, still broken for me in 1.58.0.
Somehow this only happens with the production versions (both 1.58.0 and 1.59.x) but not locally in debug mode.