Visual Studio Code search across files (find in files) is not working - visual-studio-code

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.

Related

Recent Locations in vscode (Like in IntelliJ)

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

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.

VS Code does not see existing file

Apparently VS Code does not list existing files in files dropdown (Ctrl + P command).
Here is what it shows:
As you can see, the file laravel-2019-09-26.log exists in the directory (left bottom), but not in the files dropdown. After I open this file from the Explorer tree, it starts showing in the dropdown.
Am I doing something wrong or does this happen for everyone? Or is this command supposed to show previously opened files only? If so, what is the way to quickly open any existing file in the workspace?
N.B: I have gone through this related question. No one has mentioned this problem, making me think that this might be specific to my machine.
Edit
For future readers, second answer provided by #michaelze is spot on. VS Code by default does not list files mentioned in .gitignore. You can change this setting by going to Settings panel (File > Preferences > Settings) and typing useIgnoreFiles. This will bring up two boolean settings named Use Global Ignore Files and Use Ignore Files. Turn off these two settings and all workspace files will start showing in the files dropdown. Works correctly as of version 1.38.1.
As those files are .log files, I assume, they are maybe mentioned in the .gitignore file? Maybe this can help you? Visual Studio Code - Automatic exclude based on .gitignore
The list you are seing when pressing CTRL + P is called recently opened. When you open one of the files, it was recently open, so it shows up. The CTRL + P menu also has a files results section that lists actual search results from the files you have in your workspace. None of your .log files are showing up in this section (hence the section is not visible).
The laravel-2019-09-08.log file is also missing from the drop down.
I was wondering if maybe the listing is capped to a certain number of files. Try to be more specific with your search. In my version of VSCode, I can search for files using multiple words. Maybe try searching for "laravel 26" to find the file you are looking for?

Eclipse Ctrl+Shift+R not showing all files in the project

When i press Ctrl+Shift+R to open the Open Resource Dialog box, the filter box does not show most of the other resource files for example.. jsp, xml etc. it works fine with all the java files.. This is happening for only this particular java project. i have refreshed the project multiple times but still no-go. I have also rebuilt the index for eclipse under workspace/.metadata/.plugins/org.eclipse.jdt.core by deleting the index files but to no avail.
I am using eclipse Kepler version. Any help would be great..
Thanks All. Yes i had closed and opened the project many times. I have also not set any Resource filter exclusions. What i noticed was that opening any of these files for edit would set off an alert saying file was derived and would i like to edit? But on the properties for these file they were not ticked as derived but rather as Archived. So had to manually hunt for the parent folder which was making these files as derived. Also noticed that the Open Resource Dialog box has option for including Resource files "Show Derived Resources"...
This one helped me solve the problem
Eclipse treating all the files in a project as Derived
This is going to sound ridiculous...but maybe this'll help others too: make sure your file search string is correct! You may need to begin it with a wildcard (*).
I lost about 45 minutes on this as the result of user error.
I was looking for some local files named eRCaGuy_PPM_Writer.h and eRCaGuy_PPM_Writer.cpp (from my repo here). So, I pressed Ctrl + Shift + R and searched for ppm_writer, as shown here:
Nothing! It would not find those files! No matter what I did to the files it couldn't seem to find them. I tried all sorts of things. Then, I realized Eclipse doesn't have a fancy fuzzy search like Sublime Text 3, so I simply added an asterisk (*) to the front of the search, and voila! It works perfectly. Since the "PPM_Writer" part of those two file names is NOT at the beginning, I must start the search with a wildcard (*).
Now it works fine, as you can see here:
I've just added a note about this to my personal Eclipse setup and configuration instructions here: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/tree/master/eclipse (for my full documentation, see also the PDF and Google Drive links at the top of that page).

How to search all open files in Eclipse?

Simple question: how do I search all the files currently open in Eclipse? Note: I don't wanna search all the files I have in that workspace, just the ones open in tabs. Is there an easy way to do this?
Closest way is selecting several resources in Navigator or Package Explorer view, then press Ctrl+H and choose 'Selected Resources' radio button. It will limit search only to selected files.
CTRL+E on Windows or Linux, and Command+E on OSX.
There's no way to do that at the moment.
The easiest solution would be to select your files manually (holding CTRL + click on file) and to specify "selected resources" as your search scope.
This may come too late for the original poster, but just in case somebody else needs to find out an answer, I had the same problem and found my solution by installing a plug-in named Instasearch. You can get it by going to Help/Eclipse Marketplace and searching for Instasearch.
You can find more about this plug-in in the following address.
http://marketplace.eclipse.org/content/instasearch
Spring produces a stand-alone Eclipse plugin (no dependencies on Spring) called Quick Search
http://marketplace.eclipse.org/content/quick-search-eclipse
For efficiency, it searches your open files first. So while it isn't purely restricting to opened files as you requested, you can still get a similar effect in practice by just clicking the first results that come up.
The currently opened files simply aren't considered special in eclipse - you have far more advanced methods of organizing your files: projects and working sets.
Working sets allow you to define sets of files, which can be used as constraints for many operations. You have to define them explicitly, but then they don't change just because you've closed a file.
There is no find-in-open-files command in Eclipse, no.
I think that the main reason find-in-open-files is not implemented in Eclipse is probably because the set of open files is for many users rather insignificant. (In fact, I don't know (or care) which files I have open. (I even have Eclipse set to automatically close editors/files when they become too many). If I want to navigate to a file, I open it. Limiting a search to the files I currently have open would be completely pointless for me.)