4 ms·
The best form of history, undo and redo I've used is on hte various Jetbrains editors. It's a feature called Local History and is insanely useful. 1. It's alwa
by cletus 4y ago
The best form of history, undo and redo I've used is on hte various Jetbrains editors. It's a feature called Local History and is insanely useful.
1. It's always on. It never requires an explicit save or commit;
2. It automatically saves any changes and timestamps them;
3. You can view the state of a file or a tree at any moment in time and then pull out that file (or tree).
4. If you do that, it becomes part of the temporal history so you can always go back.
I find this completely natural because usually when it's necessary you think "Oh I need to unwind most of what I did in the last hour" or "I changed something I shouldn't have yesterday". You're not thinking about a line (or a tree) of changes. You're thinking about times and possibly ordering ("I changed X right before I changed Y").
- 323 4y agoVS Code has that feature too, but only for individual files.
- alisonatwork 4y agoI wish VS Code would expand on that feature, coming from IntelliJ. It's really annoying that you need to type the name of the file you want to see the local history of, even when it's the currently active file in the editor. There should be a sidebar widget for it that's active for whatever the current file is. The cool thing with IntelliJ is if you accidentally deleted a file you can just touch a blank version of the file and the history comes back. Not sure if VS Code does that yet.
- 323 4y agoThere is a sidebar widget. But it starts merged in the File Explorer view, and you need to drag it over from there to the sidebar to make it independent - https://stackoverflow.com/a/71522634 https://stackoverflow.com/a/71522634 The widget is called "Timeline". > The cool thing with IntelliJ is if you accidentally deleted a file you can just touch a blank version of the file and the history comes back. Not sure if VS Code does that yet. VS Code does keep the history after file deletion, but I'm not sure how to access it from inside. I had to manually rummage through the storage directory to find a file I accidentally deleted, but it was an file which was never saved (think Untitled), so it didn't had a path that I could try creating a blank file at.
- alisonatwork 4y agoFantastic! Thank you so much. I think it's a fairly common situation that people using programming tools (VS Code, git, vim etc) can go for years without realizing there is a built-in feature that can solve exactly a problem they always struggled to solve. I'm not sure how to surface that sort of functionality in the tool, but I'm glad HN is here to point it out. One similarly cool thing I learned in a recent comment is that if you press dot (.) on Github web interface, it will launch an in-browser VS Code instance to edit the file you are viewing. Nifty!
- 323 4y agoIt helps to read the VS Code monthly update release notes, it takes about 3 min, but you'll be aware of all new features they introduce.
- edub 4y agoYou are a faster reader than me. The October update has around 4,700 words plus plenty of images to digest. I understand you likely mean to review the highlights, but a non-trivial amount of information is in each months update. And if you haven't been keeping up for the past 6 years, it isn't easy to catch up now. Not to mention the breadth of the marketplace.
- cletus 4y agoOr you can just look at the history of the folder.
- adrianmsmith 4y agoYep, I use Apple Time Machine for much the same purpose. Once you've set it up, it's always on, you can just go back in time (the granularity is once per hour, but that's been enough every time I've needed to use it) and restore (or make a copy of) any file or folder. Saved me quite a few times when Git has let me down.
- cwillu 4y ago> "Oh I need to unwind most of what I did in the last hour" or "I changed something I shouldn't have yesterday" Vim's :earlier and :later can take a time parameter (i.e., 30m, 2h, 1d) which does exactly that.
- jansan 4y agoLocal History is hidden in the File Menu and does not have a shortcut. It is one of the most useful features in the Jetbrains editors, so I set Alt+Z as a keyboard shortcut (because Ctrl+Z is undo), which after a few years of using it still seems like a good idea. One point that is missing from your description is that it always shows the previous state in the diff view, which also feels really natural to use (I only sometimes whish the diff markers were more distinguishable from the inspection and ToDo markers).