-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent the "Start a build for this project to get the freshest data?" notification from spamming #23
Comments
It seems like the notification would appear only when the rescript-vscode/server/src/server.ts Lines 144 to 147 in 9bbacb4
The notification becomes spammy if |
IIRC
It might happen when you rebuild project often. |
It should only pop up for the first file of a project you open? Is that not the case for you? Got a video? |
Unfortunately I can't seem to reproduce it. It happened after I converted everything from ReasonML to ReScript. @Arafatamin, @thezjy, @mickeyvip, @BlueHotDog, @darenju, @kgtkr, @FilipKittnar. |
Now that you mention it, I think I had the same problem than you: converting from ReasonML to ReScript. I have not tried to make a new project using ReScript directly (partly because of the incomplete syntax highlighting), so I cannot say if the problem goes away after some time, or just after the first file was open. |
@chenglou , this happens very inconsistently but this morning it actually happened so I took a video. It can be seen how the .bsb.lock keeps appearing and disappearing when switching between .res files. But as I said, this happens inconsistently. Yesterday it was fine. |
I'm suspecting that this happens when there's only ONE |
If that's the case, then I think it's a logical design rather then a bug. But we still need to make it less annoying. |
I'm not 100% sure about this but it seems to help to really wait a while (around 1 minute) after you click "Build" and before you switch to another file. After that it seems that the .bsb.lock file doesn't disappear. |
There's some design discussion on an alternative workflow that does not depend on starting a watcher from within the editor. Still, it's speculative at the moment. |
I'm using vercel with As I stands now I always need 2 terminals. One for rescript -w, and one for everything else through vercel dev / yarn build. |
I agree that it would be nice to be able to turn this off entirely. I feel that it makes assumptions about the user's workflow that may not be correct. I personally prefer to run a separate build/watch process and I don't want to be reminded inside my editor. |
Happy to help guide anyone interested in taking a stab at contributing a PR that makes showing that dialog configurable. |
@zth Hello :) I would be happy to start my journey of becoming a contributor to rescript ecosystem with this issue. |
@carere awesome! 😄 I'll get back to you this weekend with some ideas of how I think this one could be implemented. |
@carere ok, here's a rough breakdown of the task as I see it. This can be a bit tricky due to a few reasons, so bear with me (cc @cristianoc so you can weigh in on the solution too). Essentially, what we'll want to do is:
A crash course in how the extension works (this is only half true, but should be enough for this task):
For this particular functionality, what happens is the server initiates in a new ReScript project, sees the compiler isn't running, and sends a message to the client to show a window message asking if the user wants to start the compiler. This is all done here: https://github.com/rescript-lang/rescript-vscode/blob/master/server/src/server.ts#L186-L210 The client will present that message with an action that sends another message back to the server, asking the server to start the compiler. That's done here: https://github.com/rescript-lang/rescript-vscode/blob/master/server/src/server.ts#L916-L938 Now, configuration options are defined in VSCode, which the client has easy access to, but not the server. Therefore, I think we'll need to change the architecture slightly for this to be as simple as possible (which I think we should make sure it is, so we don't complicate things more than we need). Keeping the server from needing to know about the config option means we don't need to sync state back and forth between the server and client, given that the configuration option can change at any time, and the server would need to know about that, etc. This is what I envision:
This way we avoid the server needing to know about the configuration option all together. Does that make sense? Please feel free to open a WIP PR as soon as you want, and we can continue the discussion in there. |
@zth I have a small question about your envision. It seems that all we need is a global configuration before prompting the showMessage |
Looping back to this, me and @cristianoc talked some and we think it's best if we do indeed forward configuration to the server, because we'll have other use cases for that too. So @carere if you don't mind, please hold off on this for a little while as we sort out how we'll handle configuration on the server, and the work here will be much more straight forward. Will reply back here once we've fixed that centrally. |
Forgot to answer this, sorry... 😄 I think we mean the same thing, but call them different names. This is my view:
|
Ok, well I was waiting for further info since your last message 😅, anyway great news. I'll tag you on another issue 😉 |
@carere yes, sorry, I know I told you to wait. I'll make it up to you in the next one, I promise! |
@carere if you're still looking for issues, there's one: if you miss accepting the notification when the editor is started, and the notification is gone, there's currently no way to start the build later (except restarting the language server). Also, presumably now that one can opt out of it via config, there's no way to start it manually just once, without going into the config. |
@cristianoc Ok, so I guess we have to create a new command which can launch the build process in background? |
I guess so. Another option is having a button just like the one for "Stop Code Analyzer". Perhaps @zth. has some thoughts on this. |
My 5c - I'm not a fan of running processes automatically like this from the extension. I've done a lot of this previously in the RescriptRelay extension, and I've had so many issues with orphaned watch processes staying around etc that I had to remove that feature. So my inclination would be to avoid auto running the watcher process at all because of the complexity/potential issues it brings. |
There's also the completely opposite approach in the spectrum. |
In that scenario, one also needs to define what happens if it's not inside a project. Should the editor tell the user that the file is not part of a project. |
We may create another issue and continue there ? |
@carere it's now possible to turn this off by config. |
@cristianoc oh yes, it's possible, but when I saw your recent messages, it feels like you were talking about what the extension should do when opening a file or a project. |
It pops up every time when a file is opened.
I don't even know what this notification means.
There should be an option for disabling this notification (in fact, every notification)
This is just annoying.
The text was updated successfully, but these errors were encountered: