drracket
drracket copied to clipboard
Editor should reload if file changed on disk
When changing a file that is opened by the editor, the editor should detect this and reload the file. If there are local changes, the user should be prompted to reload or not.
This is especially handy when doing a git-pull, or after an advanced find-and-replace from within another editor. (Didn't find a way to auto-refresh in 6.10 and 6.12)
Ps. Thanks for making programming in scheme delightful with Dr Racket! :D
I have considered adding this check but doing it only on the first edit of a file -- more precisely, when drracket thinks the buffer is not modified (saved) and an edit to the buffer happens, check to see if the file on disk has changed and, only in that case, prompt the user.
I think this would be a fine mixin to add to the framework (in the racket/gui repo) that it would make sense to use in drracket.
Glad it was considered already :) I guess it would make more sense to always check this when the window is focused. (With a file-watcher) It could be frustrating to get a popup as soon as you begin typing some code. (Sublime-Text and Visual Studio do it like this I think)
Apparently, the buffer is checked when pressing "Run". This is feels like a late.
Yes, indeed sublime seems to have a different, much more aggressive setup. If the buffer isn't dirty, it just changes the content of the editor when the file changes. If the buffer is dirty, it prompts, popping up the prompt when you are possibly in the middle of other edit operations.
The plan above is an attempt to copy what Emacs does, fwiw.
Personally I really like the behavior of some editors where they refresh changed files automatically without requiring user interaction as long as you have no unsaved changes for that file. It feels seamless and works as I subconsciously expect "computer stuff involving files" to work. But I save reflexively when editing code, so I rarely have unsaved changes that would cause conflicts.
Okay, lets declare that to be the official plan, then! Not sure when I'll have time to get to it, but at least I know what I'm going to do.
has this made it to the todo list? There is another benefit of this that is not mentioned above. Users who prefer other editors can edit over there, swap back to Dr.Racket have the reload happen, and then run and use the REPL below. If approving a reload can happen via keyboard or isn't needed then this can be a very fast process.
I didn't really realize just how close 7.8 is so I'm tempted to revert this change until after branch day, so we have a full release cycle to get experience with it in case something is catastrophically wrong that I didn't see. Any thoughts?
This did break a bunch of DrDr tests, for whatever that's worth.
Yeah, it is broken :( I've reverted it for now.
FWIW, I'm totally psyched about making this change, I do run into this all the time. So... looking forward to it! (after branch day)
This is not on master yet, but if you raco pkg update --clone drracket and then use git commands to move that over to the enabling-autoload branch you can try out the current state. I don't know of any more problems. (The one I was stalled on for a while had to do with spurious filesystem change evt wakeups that didn't seem to be coming from anywhere in the GUI libraries or in DrRacket -- I gave up trying to find them and am using sha1 now instead to check them.)
Would love to get a few more people than just me trying it, @jbclements @jackfirth (and maybe @samth ?)
I'll give it a shot tonight.
This did get merged, right? Should this issue be closed?
I don't think it did. There are some issues that I haven't been able to track down but I'm forgetting what they are right now. Something with the teaching languages, maybe?
A problem was described in https://github.com/racket/drracket/commit/b4bb32dffee586a1c78ea8304121c9754a679141 which revered the mentioned commit. There are some subsequent commits that might be related but it's hard for me to tell what's going on.
I think the main status is that the code is there in the framework but it isn't turned on in drracket.
Hey! is the feature available yet? It gets super inconvenient to close the file and open it again for the changes in files to reflect.
No, sadly.
But you can use menukey-shift-E to lessen the pain for the time being.
Robby
By any chance is it possible to search up help desk without opening browser just on drracket
@samth I believe that the current state is that the implementation of autoload is mostly in the racket/gui repo, in editor:autoload-mixin but that it does not work correctly currently. This commit merely turns it on in DrRacket (and adds a test case and some docs). I'm not sure what the extent of the buginess of editor:autoload-mixin but it definitely needs more testing and I'm pretty sure there is an interaction with the teaching languages that's wrong. (There may also be more that's wrong.)