Zulip Chat Archive
Stream: lean4
Topic: Renaming "refresh file dependencies"?
Gabriel Ebner (Jul 07 2022 at 07:00):
The command name "refresh file dependencies" is apparently quite unintuitive and unclear about what it does. For example @Chris Lovett never realized that it actually restarts the file worker, and that this is the main purpose of the command.
Should we rename it to "restart file worker" or even "restart file"?
Mac (Jul 07 2022 at 07:32):
How about "Reload File"? That way it nicely parallels with VSCode developer command of "Reload Window" as they do parallel things ("Reload File" reloads the worker without restarting the Lean server and "Reload Window" reloads the window without restarting VSCode).
Mac (Jul 07 2022 at 07:37):
(I was also surprised to discover that it restarted the worker if it broke. I had originally thought it just reset the internal Lean environment without restarting the process. Furthermore, had I not known -- due to working with the elaborator -- that it was impossible to reimport modules without resetting the environment, I would have thought it would have done just the reimporting i.e. without resetting the environment.)
Gabriel Ebner (Jul 07 2022 at 07:37):
Right, there's three commands here (with current names):
- "Reload Window" (restarts VSCode)
- "Restart Server" (restarts the Lean server)
- "Refresh File Dependencies" (restarts the file worker)
I think it's better to use "restart" instead of "reload" because it's consistent with other extensions. All of the extensions I have installed here use "restart server" ("Rust: Restart the Rust server", "ccls: Restart language server", "TypeScript: Restart TS Server", etc.).
Henrik Böving (Jul 07 2022 at 07:41):
Fyi in emacs we call it:
- lsp-workspace-restart (restarts the Lean server)
- lean4-refresh-file-dependencies (restarts the file worker)
for restarting emacs on the spot we don't really have something afaik.
Mac (Jul 07 2022 at 07:42):
When it comes to the renaming, I think there are two conflicting desires. If the problem a user has is that some imports updates are not registered, the command "Refresh File Dependencies" sticks out as a solution to that problem (whereas "Restart File" does not necessarily do so -- after all, it is conceptually possible to restart the worker without rebuilding/refreshing the dependencies). On the other hand, if the file is broken (i.e., the elaborator hit some bug and crashed), "Restart File" sticks out as a solution but "Refresh File Dependencies" does not.
Mac (Jul 07 2022 at 07:47):
Also, as an aside, since we are talking about resetting the server and elaborator bugs, does anyone know why / know how to fix a file where features like semantic highlighting and hovers is broken and/or error indicators are not updating (i.e., generally the info tree appears broken) but the info view is not? Resetting the file worker via "Refresh File Dependencies" works in that it updates the file (error indicators move to where they should be), but the file still remains non-interactive (e.g., no hovers, often no highlighting, and further changes will not update indicators).
Gabriel Ebner (Jul 07 2022 at 07:49):
I think that's https://github.com/leanprover/lean4/issues/1219
Mac (Jul 07 2022 at 07:50):
Yeah, that seems like it, as when my problem occurs in a given file, it continues to occur in the same file for the rest of eternity (EDIT: double checked, it does appear that issue does disappear at the very least after a system restart). But it only happens in certain files and without any clear reason why it does.
Gabriel Ebner (Jul 07 2022 at 07:53):
Back to the names. We could also have both commands ("refresh file deps" & "restart file") if this helps people find it. But fact is that the command restarts the file worker; that the dependencies are recompiled is very much a side effect.
Mac (Jul 07 2022 at 07:54):
I think that is reasonable (also, sorry for side-tracking the thread).
Gabriel Ebner (Jul 07 2022 at 08:33):
https://github.com/leanprover/vscode-lean4/pull/213
Julian Berman (Jul 07 2022 at 08:59):
Talking about "file workers" seems somewhat implementation-detaily to me, is there some reason an end user cares about that?
Julian Berman (Jul 07 2022 at 08:59):
I don't mean to further bikeshed the change, seems good to me, just want to make sure I'm not missing something
Julian Berman (Jul 07 2022 at 09:00):
Presumably an end user cares strictly about "my lean looks stuck" or "my imports aren't up to date" right? Not the fact that Lean happens to use one process per file.
Gabriel Ebner (Jul 07 2022 at 09:13):
If we have a restart command, then it must be clear what it restarts. The end user can also observe what is restarted by watching the orange bars. So I think it is very much relevant for the end user, because it answers the question "what will be covered in the orange bars of hell once I press this button".
Gabriel Ebner (Jul 07 2022 at 09:14):
The "file worker" terminology is a bit technical, that's why I left it out and simply called it "restart file".
Sebastian Ullrich (Jul 07 2022 at 09:15):
It's still mentioned in the restartFile
description, which is what @Julian Berman might have been referring to
Gabriel Ebner (Jul 07 2022 at 09:17):
Oops, I've just copy&pasted that from the refreshFileDependencies description. Fixed now.
Last updated: Dec 20 2023 at 11:08 UTC