Reputation: 27991
I like the feature Recent Locations of IntelliJ.
For other reasons I will use vscode (for golang).
Is there a similar feature in vscode?
I want to see a list of the my recent locations (optional filtered, so that only the locaions are visible, which where recently changed).
After a break (like lunch), this feature is really handy. It helps you to connect to your work before the break.
Especially the "show changed only" is very helpful.
Upvotes: 10
Views: 1992
Reputation: 28
I suppose you could use Vim marks (with the vim emulation extension), which is basically the same idea, but it's not really automatic.
If you're working in a git repository, VSCode will show you staged and unstaged changes in the git tab, and will also show you the diffs.
It really comes down to the fact that they're different editors and default functionalities will not map 1∶1.
tl;dr: no, not really, or at least not natively
Upvotes: 0
Reputation: 51354
At the time of this writing, VS Code itself doesn't have such a feature to show a listing of changes. It does keep track of the undo stack and changes in the workspace session, so it would only need to add an interface to that model / information.
I think an extension could also implement this by using the onDidChangeNotebookDocument
and onDidChangeTextDocument
event listeners on the workspace
object. For custom editors, there is also the onDidChangeCustomDocument
event on the custom editor provider. The extension would just track those events and display them.
FYI, this has been requested before, such as in Have a history for recently edited editors #42880 (closed as "out of scope" by bot).
There are commands to navigate back and forth between edit locations, which you can bind to keyboard shortcuts or run from the command palette: workbench.action.navigateBackInEditLocations
and workbench.action.navigateForwardInEditLocations
.
There is a way to view recent changes (in order) on a per-file basis by using the Timeline View feature, though the way it works is different. It's more snapshot oriented than individual-change-oriented. It'll show entries from the Local History feature and SCM commits. For the local history entries (snapshots from saving the file/editor), you may want to change the workbench.localHistory.mergeWindow
setting and maybe files.autoSave
and files.autoSaveDelay
.
You can change various sort order things:
"explorer.sortOrder": "modified",
"search.sortOrder": "modified",
"search.quickOpen.history.filterSortOrder": "recency",
There are also various commands for opening or navigating between recently used editors which you can bind to keyboard shortcuts: workbench.action.quickOpenLeastRecentlyUsedEditor
, workbench.action.quickOpenLeastRecentlyUsedEditorInGroup
, workbench.action.quickOpenPreviousRecentlyUsedEditor
, workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup
, workbench.action.openNextRecentlyUsedEditor
, workbench.action.openNextRecentlyUsedEditorInGroup
, workbench.action.openPreviousRecentlyUsedEditor
, workbench.action.openPreviousRecentlyUsedEditorInGroup
. These are kind of close to what you want but are in granularity of files, and not of individual changes.
If you don't care about the order in which the changes were made, and are okay with viewing changes by SCM commit, the Source Control View has a multi-diff feature (see my answer to In VS Code, how can I view a list of files with staged/unstaged changes, where clicking an entry opens a comparison/diff view?).
Upvotes: 0
Reputation: 3320
I am using the Gitlens extension and I use the shortcut "ctrl+shift+g g"
for the command workbench.view.scm
to quickly see the files modified since the last commit and navigate among them.
Upvotes: 0
Reputation: 77
Ctrl+P will display a list of recently opened files in Vscode
You can use Timeline option at the right-bottom corner of the vscode for comparing previous file and current changes of the file that is in currently opened
You can even compare the files with options on right clicking the file
You can get more about code navigations in this video https://www.youtube.com/watch?v=MuQmMsIpI04
Upvotes: 1
Reputation: 427
This function is called "navigate Back", you find it also in the Key Bindings for Visual Studio Code and more accessible within vscode from the keybindings UI.
Upvotes: 2
Reputation: 241
@guettli They are different editors, so it will be hard to always find the exact same feature. I think there is nothing like recent locations in vsCode, at least when i'm writing this. Will there be something like that in the future? Probably.
Ctrl-P will display a list of recently opened files, and by selecting one of the files it will go to the last location when editing the file. To see the changes in a file(w/ git) you can right-click it and select the "view timeline" or view the changes with the git button. Not exactly what you asked for but may be useful.
Upvotes: 1
Reputation: 20537
If you use git, you get most of what you request here. Vscode has a git extension in the sidebar that shows you what files you have changed, as in unstaged and staged changes.
You can also jump between location, with alt+left/right
arrow. This is independent from git. It just remembers your last cursor positions.
If you are willing to use an extension, there is one that seems to do what you are asking for, judging by its name: https://marketplace.visualstudio.com/items?itemName=percygrunwald.vscode-intellij-recent-files
Upvotes: 2