Always asking "Start a build for this project to get the freshest data?"

I was using ReScript and VS Code successfully on Windows and am making the switch to Mac. Every time I click on a .res file I get the “Start a build for this project…” question. I don’t understand why it keeps asking me this. On Windows I’d get this the first time I started up a project but then it would stay working for a while. What am I doing wrong? I am building this project after not touching it for a few months. Maybe that is the problem? I just updated the package.json to dev dependency of rescript to ^10.0.0 and gentype ^4.5.0 ran “npm install” but the problem remains. After searching on the ReScript issues, I see there was an old issue about this. Maybe this happens if there is no bsblock file. I don’t see one. I think this was handled automatically when I was using Windows. Ok now trying to type “rescript build” from command line but I get “command not found: rescript”; maybe this is a path issue. But the extension seems to be compiling things just fine. Hmm… Doing “npm run re:build” works fine - no error generated - but I don’t see a .bsb.lock file.

I started a new project from scratch using create react app. Then I followed the instructions here to add ReScript to an existing project. Installation | ReScript Language Manual And I am seeing similar behavior where each time I open a Res file it prompts me to “get the freshest data?” It seemed to work for a while but then something broke and now it keeps prompting me. Really stuck here. I’m not doing a build -w but instead relying on the extension to keep compiling as changes are made.

Hmmm…Maybe this is related to this bug. Each time I switch to preview a new file I get the “Start a build?” question. But if I double-click on a file this annoying behavior goes away. But the moment I close every open .res file, then the next one I open gives me the “Start a build?” question. I’m not sure what the recommended workflow is here. Should I ALWAYS start a rescript build in watch mode to keep it going no matter what .res files I have open?

Yeah I usually keep it running in the terminal at all times. My experience has been the extension seems to work most reliably this way.

1 Like

I don’t know your exact problem and although I don’t have one I find the question everytime I open a rescript project a bit annoying.

So I just turned it off by editing the language server. So in the extension folder there should be a server/out/server.js file. There you can set the option askToStartBuild to false.

If there is a setting in VSCode (sorry, I’m using neovim), forget about it :smiley:

For posterity…maybe I have a different version of the language server, but I had to do a slightly different tweak. On OSX in file ~/.atom/packages/ide-rescript/vendor/server/out/server.js, I altered line 136 to the following:

        let firstOpenFileOfProject = false; //root.openFiles.size === 1;

Annoyance suppressed!