VS Code extension stops working - anyone else?

Most of the time the VS Code extension is like magic. Make a tiny change to my code and it instantly recompiles everything. I see the changes instantly in my react app. But every so often - like right now - it seems to not work at all. I don’t get the “would you like to start a build?” message popping up. I’ve rebooted VS Code and Windows a few times, tried to do some manual builds - which work - but the extension seems dead. Anyone else seen this? What do I do to get it started again?

Just tried to disable the extension and re-enable it, but it still doesn’t work.

1 Like

I just tried rescript build -w and see a message…

Stale file detected :  C:\Users\justi\source\repos\shortcuts\.bsb.lock

Then I stopped the watcher process and the extension seemed to work again. I now see "Start a build for this project to get the freshest data?" message box. Note that previously I tried running a regular build from the command line without the watcher and it worked but it did not cause the extension to become unstuck.

I’m just a single developer doing a tiny bit of coding every day or a dinky little project. And the VS Code extension keeps failing. Occasionally it is due to some known issue, like a cycle (which shouldn’t crash the extension regardless). Other times it just fails - stops compiling - and I don’t know why. Then I play this game where I clean, build with watcher, build without watcher, close VS Code, until finally, I’ll see that pop up that says something like “Want to build rescript to get the latest?” Sometimes it takes 10-15 minutes of wasting time to get the extension working again. This is on Windows. Maybe everyone is using a Mac? I can’t be the only one experiencing this. Anyone else? What can I do to help diagnose the problem? Are there some kind of diagnostics?

Error: could not acquire lockfile C:\Users\justi\source\repos\shortcuts.bsb.lock
Could be another process running in the background
Either kill that process or delete the staled lock
Try run command: kill 28144 || rm -f .bsb.lock

1 Like

The best workflow is to just always build with watcher, you shouldn’t run into any problems this way and you also get a clear feedback loop :slight_smile:

1 Like

I find getting feedback inside the VS Code editor about syntax errors and other problems extremely useful - essential even. That is the expected behavior/feedback loop for modern development with popular languages in both VS Code and Visual Studio. Without it you have to parse the terminal output where is says “error line …” and then find it in your code. The terminal errors scroll away too. The Problems panel and F8 won’t help you. I assume that is why the Vs Code extension was built in the first place. I never would have started using ReScript without a Vs Code language extension. It usually works. I just wish it was more reliable.

You’re right. @Ferdzzzzzzzz is not saying to ignore vscode’s error reporting features and just rely on compiler ouput terminal, I think he means to start your build watcher in a terminal which is more reliable than extension’s build watcher.

with that being said, your concerns are valid. we should make vscode extension more reliable.
current implementation focuses on having separate process for code intelligence (hover, go to def etc.) to prevent the server crash but the error parser is not separated and it doesn’t cover the circular modules error case thus makes the server crash.
what can be done is to fix the problem with error parsing and a feature for restart rescript extension (not whole vscode) would be useful for unexpected server crash

1 Like

Indeed, regardless of the extension’s reliability I always prefer to separate static analysis from compilation/transpilation/build. And yes, I would never be able to dev without static analysis or go to def :sweat_smile: