-
Notifications
You must be signed in to change notification settings - Fork 50
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
feat: replace stale dep notifs with "restart file" infoview button #419
Conversation
Looks like I accidentally edited the build artifact again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mentioned that this will be urgently needed for the next Lean RC, and I don't want to block you on that. The implementation looks fine at a glance (I did not review in detail). I would midly prefer not to pull in a dependency on webview-ui-toolkit
and just use plain CSS to style the button, but I will leave that decision to you.
"Restart File" however is central to working with Lean and you often cannot even get started with working on a file without using it.
I find the whole "Restart File" situation to be generally unfortunate from a UX standpoint especially for less technically inclined users, but there's sadly nothing we can do about it at this point.
Maybe the central issue that has to be addressed is not the button or lack thereof, but this point about the system's design. At various points we discussed re-adding an option for users to configure the server to behave a bit more like Lean 3 and auto-reload any file whose dependencies have changed. It is already computing stale dep notifications, so it sounds like that might not be too complex implementation-wise. The original issue in Lean 3, noted on Lean.Server, was that given a dep chain A->B, Lean 3 would refresh A as soon as B changed even if B wasn't saved. I think it would be completely okay to refresh only if the user saves B; this way accidental changes don't trigger recompilation, but the 'restart file' notifications/button become less frequently needed. What do you think? Why do you say nothing can be done?
Automatically rebuilding saved files was the previous Lean 4 behavior, people did not like it. Thus the status quo. edit: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Imports/near/268441788 |
It's worth pointing out that this is not perfect, since we use file watchers and
As Sebastian mentioned above, we've seen a lot of feedback from Mathlib users that manually indicating that they want to trigger a rebuild is what they want, even when initially opening a file and well after saving a change.
Because we've tried more automatic approaches and people strongly expressed that they were unhappy with them. The fundamental problem is that getting the semantic information back in sync after a change is so expensive in Lean and that so many files need to be rebuilt entirely. If this could be improved and both cost and latency to get the language server back in sync were acceptable, then we could move to an interaction model that is closer to other language servers. |
I can see Gabriel expressing a preference there because he has Also, I am realizing now (after merge; sorry) that there is a regression in the UI: Lean no longer indicates that there exist dependencies that have changed. Could we have a followup PR making the |
The diagnostic should be visible under 'Messages' (modulo #424). |
You're right, my bad. |
I don't mind supporting an option for this. I'll put it on my to-do list :-) |
This PR adds a "Restart File" button to the bottom right of the InfoView and deletes stale dependency notifications entirely.
I've found the latter to be way too noisy, especially now that Lean 4 on master will inform us about stale dependencies as soon as the dependency changes (it's especially noisy when switching branches).
The central issue with the notifications is that they stick around even after you switch away from the file.
Now, after fixing the
fullRange
behavior of the extension, the stale dependency diagnostic will be displayed in "Messages" anywhere in the file. The button in the InfoView should also be sufficiently visible that after reading the message, users know what to do.This PR also fixes a bug where the InfoView would not correctly display the "imports out of date" error in the InfoView because the server doesn't respond to requests when it doesn't keep going after processing the header.