Recent Locations in vscode (Like in IntelliJ) - visual-studio-code

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.

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

#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.

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.

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

Related

How do I turn off "Contains emphasized items" in Visual Studio code?

I need to figure out how to turn off emphasized items in Visual Studio Code
This might sound like a strange requirement, but in my workflow vscode functions as less an IDE than a cross-platform ViM-esque frontend with lots of remote development tools built-in.
Due to this use case, I don't need or want the linting features to show up in the file browser. How might I accomplish this?
Attempts to solve the problem
I've run out of search terms here and cannot find an answer.
Searches including terms in this question's title yielded little
SO-specific search queries also yielded little
This seems to be somewhat related, at least as a representation of the "feature" I'm referencing: VS code containes emphasized items but no error
VSCode "preferences" do not appear to show what I'm looking for, likely an issue with me not searching for the right variable name.
In my experience with VSCode it has been wonderfully customize-able, so I'm guessing there's a setting somewhere ready to be modified to accomplish this. Any help much appreciated, thanks!
My use case was a bit different: after viewing some files in a git submodule those files became linted, and errors and warnings cluttered up my VS Code Explorer file browser window on files I had no intention of ever handling. I basically wanted a way to clear out those lint warnings, and found it here. The solution is to reload the window:
CtrlShiftP on Windows/Linux, ⌘ShiftP on Mac -- then select "Developer: Reload Window"
One by-product of reloading the window is that it clears out those unwanted warnings (at least until the next time I visit the file). It also has the effect of clearing out warnings on files that I would normally want to see, of course, but chances are I'll be visiting those files again soon, so it's fine. Not a perfect solution, but it works for me and my use-case; hopefully it can help others.
I don't know how to turn it off, but I had this on multiple folders and I fixed it by renaming the folder to a random name, then naming it back to the name it was before and the error would go away.
If you have this issuse then uninstall extention then CtrlShiftP on Windows/Linux, ⌘ShiftP on Mac -- then select "Developer: Reload Window" then type developer: relode page this issuse automatically resovle
i have this issuse then i uninstall extension then this issuse resolve.
I was able to permanently prevent this by adding the files to the .gitignore file. It seems that this happens in a cloned repository when you add new files.

Visual Studio Code search across files (find in files) is not working

I am using Visual Studio Code 1.31.1 in MacOS 10.13.6. I open VSCode, I open a folder of text files, and I press command-option-F, or use Edit -> Find in Files. I search for a string that I know for sure exists in multiple text files in the open folder, and it says it can't find it.
Searching across files works if I have the folder open and have each and every single file open as a tab, which is rather pointless. Is there a way to search across files without actually having them all open as tabs?
I think it was because I opened a folder on Google Drive File Stream. It works fine on local files.
In my case, this was caused by me accidentally toggling the "Search only in Open Editors" option.
Had this same issue, the search functionality was only working for files that were open in the editor. My issue was that VS Code had an update downloaded and ready to update, so I just restarted VS Code, let the update finish and the issue was gone.
It could be that the search is looking into all folders (including node_modules ones), so as it is too big, the search never ends
To fix that, you can list all folders that you want to exclude of the search, to do that, open your vscode settings (ctrl + ,) type "Search: Exclude" in the search box and add your folders. (Btw some are already added by default)
Besides, remember to enable that filter in your search, this is simple, just toggle on the gear button in your search section
If you are still not sure about what to do, take a look in this briefly gif
Had the same issue on Mac, seems like it was related to Google Drive. once I moved the files on my local drive the search worked fine.
Check out your vs code settings. It excludes some folders by default e.g. node modules.
Go to settings, search "Search" , there will be list to exclude folders.
Remove item which might be accidentally got included, which might causing search item in all directory is not working.
I had this problem today. Turns out I had a deprecated setting for advanced RegEx searches "search.usePCRE2": true, Once removed, search started working as expected.
I just had this problem on VS Code 1.58.2 / Mac OS 10.15.7
None of the above solutions worked for me, it still keeps saying 'No results found in open editors' no matter what I do.
But I did get it working by changing the 'Search: Mode' in the settings (for the workspace, or any other scope if needed) from 'view' to 'reuseEditor'.
Yes, this doesn't fix it if you really want the results in the Explorer tab rather than a completely new editor window, but it works.
I had the same issue, i fixed mine by removing files in .gitignore
I had an issue with searching in a project with git submodules and found that the gitlens add-on defaults to ignore searching any submodules:
Setting this to 2 or more may address your problem.
In my case, I had somehow gotten my Explorer set on a subfolder of my project. Closing VS Code and reopening the workspace reset everything and search worked again.
In my case, it was files with no extensions I was not able to find. Once I added those files an extension, I was able to find them via the search feature.
I initially wrote this answer describing a confusing "inverted" behavior of the Search only in Open Editors option/button.
However, after playing around it turns out that what the GUI was showing was not "in sync" with what the search results were returning. Toggling the options a few times appears to have fixed things.
So if your search doesn't appear to be returning any results, I would suggest toggling the Search only in Open Editors and Use Exclude Settings and Ignored Files options.
Otherwise, for information, here is my previous answer:
VS Code has an extremely confusing "inverted" interface when it comes to the option Search only in Open Editors.
There is also another option which affects how search works in a confusing way: Use Exclude Settings and Ignored Files.
The below screenshot shows both:
Note that:
Search only in Open Editors is OFF
Use Exclude Settings and Ignored Files is ON
With these options I get search results back, with them set the other way around - confusingly - I get nothing.
Important to note:
If you turn Use Exclude Settings and Ignored Files OFF, then VS Code seems to stop searching any files, EXCEPT for those which are currently open in tabs. This is very confusing and not the behavior one would expect. The expected behavior would probably be to search the whole opened Folder/Workspace by default.
If you turn Search only in Open Editors OFF, then only open editors will be searched. This is the "inverted" behavior. My current build of VS Code has the indicator "inverted" for this GUI element. When it looks like it is in the "ON" state, it is actually "OFF". When it looks like it is in the "OFF" state, it is actually "ON'.
These two things interact in unexpected ways: (This is the behaviour I observed after toggling both buttons a few times. It is different to what I was seeing a few minutes ago.)
Open Editors (looks like) it is OFF, Use Exclude Settings (looks like) it is ON, search appears to search whole workspace.
Open Editors (looks like) it is OFF, Use Exclude Settings (looks like) it is OFF, search appears to search open tabs only.
Open Editors (looks like) it is ON, Use Exclude Settings (looks like) it is OFF, search appears to search whole workspace.
Open Editors (looks like) it is ON, Use Exclude Settings (looks like) it is ON, search appears to search whole workspace.
I suspect that when typing / editing the search terms, replace option, and files to include/exclude options, VS Code does not check the state of the option buttons before performing the search. This is likely the source of the bug I was seeing earlier.

How to merge files(differentiate) in visual studio code

I am using Visual studio code for angular2 application. The requirement is to merge files, so, I want to differentiate changes in two files as it happens in Netbeans IDE. Is there, any extensions available to achieve the task in visual studio code.
For e.g - Merging Two files by differentiating changes like below:-
Please suggest some solution.
abc.component.ts (located in project1)
abc <-- text for understanding purpose
def
abc.component.ts ( located in project2)
abc
I want to differentiate two component files and push changes in another like it happens in Netbeans IDE? Is there, any solution available for Visual studio code?
First using vscode natively with the git toolset
(Make sure to look on the second title as it's a better native way!)
This way may be available on older version of vscode too! Still a good thing to know! (even we should always run on the latest version! And vscode is always keeping getting better and better).
A native powerful and cool way is to use the git toolset within vscode! It still not the most fluid way! But if you are in a setup where you don't have anything else or time or resources to use anything else! Also as a requirement you need to have a git repo initiated! Here we go:
First we will use the change and diffing capability of the git tool set. And the steps go as bellow:
Commit all the current changes
once done: copy past the other file to diff on the place of the current one. And save.
Cool now in the git pallet you can see the file in changes list! Click on it and the diffing editor will show!
Bingo this is it! You can compare and make direct changment! The diffing will keep happening in real time. Note the current state is in the right. And you make changement there.
Here an illustration of direct modification for instance the part in the left is missing from the current file
And here another illustration (current have in plus)
Well to sum up! Git tool and diffing in vscode is so powerful! And all that one need! The only problem is the extra step of committing and cleaning after if desired!
Here some tips! If you want to have the commit history cleaner! Or not have a merge separate! You can remove the last commits from history as much as you need: Without hard reset and commit again a cleaner one!
git reset --soft HEAD~1
You can check
How to cancel a local git commit
Otherwise it can be ok with atomic commit and merge mention!
Also if what you need is to be able to keep a lot from the current file! You can copy the current elsewhere! past the other file to compare! commit ! and then past again the old one! You'll have the old in the right and as current (Not as described on the above) In such a scenario this work well! (Hacky a bit but you may need it).
Native way (direct open of the compare editor)
(May require the newer version of vscode)
open a file that you gonna compare
open the command pallet
CTRL + SHIFT + P
type file: compare
You can see the different possible ways! For a file we can choose compare active file with.
Then you choose the file! The file need to be within the project directory.
And then you choose a file and the compare editor will open
The above was tested on my brother computer on a new vscode installation. I wasn't sure at first if it was part of the core! And i just confirmed that it is. That too remove the need to the method above involving git! And it's the best native way to go with.
Vscode extensions
Here two extensions i suggest the first:
https://marketplace.visualstudio.com/items?itemName=jinsihou.diff-tool
Easy and simple! It add two elements to the right click menu:
In current file right click -> Select as first file for diff, select one again to view the diff results
select to compare and compare with select no more simple then that !
Another extension to check:
https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-diff
I prefer the first! As this one compare a lot to the native way. And having the control in the contextual menu is just great.
Out of vscode! Using other tools
A quick google search and you'll find a lot of tools!
https://meldmerge.org/
meld merge is cross platform and open source and nice!
in linux and debian:
sudo apt install meld
Otherwise you can check the long list here:
https://www.jotform.com/blog/25-useful-document-and-file-comparison-tools/
https://stackify.com/code-merge-tools/
There is too winMerge to mention (an open source project for windows)
https://winmerge.org/

How to activate revision info in line number view

I know of an Eclipse feature to show revision information (gradual coloring, more info like revisionnumber, date and author on mouseover) for the last changes in a line in the linenumbers-view.
Does anyone know how to activate this feature for a file, or even better, by default? I accidently hit some shortcut lately which made it show in one file, it does not show up in the others, though.
This is called "Show Annotation" and you can find it in the "Team" menu. Since this is a pretty expensive operation, you can't make it the default.
Regarding the shortcut: You have to enable the command group SVN.
Window -> Customize Perspective... -> Command Groups Availability -> check "SVN".
If you do this, some SVN actions show up in the toolbar which you can remove again (if you want) using the same Customize Perspective dialog (tab Tool Bar Visibility).
Remapping the shortcut did not work for me but enabling the command group did (with the default key mapping Ctrl+Alt+A).
(did not find a way to reply to Aaron's answer so I had to create a new one)
I found my way here while trying to find a way to get the option to show up with code from my git repository.
A lot of the logic in the other answers applies to git too, and I followed the equivalent steps for git but it didn't help me.
It turned out that my projects, although imported from a git repository, hadn't been connected to (or had become disconnected from) the eclipse git integration. I think this happened because I imported the projects before I installed the elcipse git plugin.
I needed to connect them thus:
Right-click your project (or multiple selected projects) in the Project Explorer
Select 'Team' > 'Share Project...'
The default settings were fine for me, but change them if needed
Click 'Finish'
I found this solution here.

Show modification (new and edited files) since a given date

How can I ask TFS to show me only modified files (new and edited files) in a workspace (or in a folder) since a given date.
Is it possible? or do I have to go myself through all the history and build my own "modification tree".
Open the Source Control Explorer in Visual studio (View->Other Windows->Source Control Explorer), and select the top folder for your project. Then right-click and view history.
This will show all check-ins for all code in this folder ordered by date. Then select two dates from the list of check-ins, right click and choose "Compare". For example if you wanted to see all of the code changed in the past month click the most recent checkin and the checkin from a month ago.
This will show all of the code changed since those two points in time. You can also choose just the past date to compare against your current code. This works in VS2015 which is what I'm using right now. Good Luck.
Use the command line
tf history -noprompt -server:http://tfsserver:8080/tfs/DefaultCollection $/TeamProjectName/path
-version:D2006-12-01T01:01:01Z~D2006-12-13T20:00:00Z -recursive
-format:detailed -login:DOMAIN\name,password"
change the dates in the version flag to what you need and it should get you what you want.
If you open the menu item File->Source Control->Find In Source Control->Changesets... (you must be in Source Control Explorer for this to be available). This will open the Find Changesets dialog. You can then search for change sets by date on a given source folder.
The down side is that you then have to click the details button on each change set to see which files were changed (Double Clicking closes the dialog).
If you are searching for changes this may be the better way. It will allow more interactive searching. If you are trying to print out a report for others to read (or for Change Documentation) then the command line way shown by Alex is better.
Open the Source Control Explorer in VS10 (View->TeamExplorer->Source Control Explorer) and right click to project and click Compare. You can see different options for view. I normally use "Show items that are different" in order to see difference between local and server.