rescript-vscode icon indicating copy to clipboard operation
rescript-vscode copied to clipboard

No errors shown anymore after clean & rebuild

Open cknitt opened this issue 1 year ago • 10 comments

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

cknitt avatar May 23 '24 14:05 cknitt

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'
}

cknitt avatar May 23 '24 14:05 cknitt

Perfect. thank you!

zth avatar May 24 '24 05:05 zth

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.

fhammerschmidt avatar Jun 11 '24 13:06 fhammerschmidt

Feels like fixing this should be quite straight forward. @fhammerschmidt want to take a stab at it?

zth avatar Jun 11 '24 16:06 zth

Is that so? Can you give some guidance on how to approach it?

fhammerschmidt avatar Jun 11 '24 17:06 fhammerschmidt

@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?

zth avatar Jun 12 '24 06:06 zth

Sounds good, Ill take a shot.

fhammerschmidt avatar Jun 12 '24 07:06 fhammerschmidt

@jfrolich This was fixed as part of #1033, right?

cknitt avatar Aug 31 '24 05:08 cknitt

No, still broken for me in 1.58.0.

cknitt avatar Sep 09 '24 05:09 cknitt

Somehow this only happens with the production versions (both 1.58.0 and 1.59.x) but not locally in debug mode.

fhammerschmidt avatar Oct 24 '24 08:10 fhammerschmidt