Visual Studio Code: Search Within Files but Exclude Folder - search

In Visual Studio Code (not to be confused with Visual Studio) there is a search interface (click the mag glass at top left).
It has a "files to include" field, and a "files to exclude" field.
I know that I can include or exclude a file from my search by entering the name of the file, or using a wildcard like *.js.
Is there a way to specifically include or exclude a directory by using these fields? If not, how would I do that?
Edit:
Some have said that this question may be similar to How can I choose folders to be ignored during search?
I think it is fundamentally the same question, but as I said in a recent comment on that question:
"There is nothing in the title of this question to indicate that you are asking a question about a specific tool (Visual Studio Code). And while you do have it tagged visual-studio-code - making it appear in searches about that tool - the searcher will not necessarily know that this question is about VS Code. Also, you use a Mac specific keyboard command that is not really relevant to the question at hand, and makes the question seem non-relevant to non-Mac users."
So, yes, I guess it's the same question. But I don't think it's reasonable to expect me to have found it.

You could either change the global settings (CTRL + , by default), for example to ignore anything in node_modules
"search.exclude": {
"**/node_modules": true
}
Or if you don't want to set a global setting, you can just add the foldername\* to the "files to exclude" field. So in our example
files to exclude node_modules\*
Hope this helps anyone searching for it in the future.
For reference:
https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options

you can exclude or include a folder by using the files to include/exclude text boxes.
https://github.com/Microsoft/vscode/issues/17164#issuecomment-311750417

Update 1.73.1 finally addresses this issue and provides an easy way to include/exclude folders in the tree view

Related

Hide specific files in IntelliJ IDEA

I know from Intellij IDEA. Hide .iml files that I can hide from the Project Tool Window specific file extensions on all directories. However, I have unsuccessfully tried to hide specific files (e.g. mymodule/blah.tgz) without getting all tgz files to hide as well. In Settings -> Editor -> File Type, at the bottom, I have tried specifying full and relative paths (e.g. ~/projects/mymodules/blah.tgz) without luck.
How can I achieve this? Is this supported at all? I'm using IntelliJ 14 Ultimate.
Please see the following comment.
How to hide unnecessary files from intellij project view?
I usually use the scope support in Idea to filter in/out files/folders in project tool window and other windows, i.e. Find.
I hope this helps.

Exclude files from Android Studio lint spell checker

The Android Studio lint spell checker flags hex codes that look to it like words in certain files that would be better off unchecked, such as values/colors.xml and build/intermediates/dex-cache/cache.xml.
How do I tell lint to not spell check certain folders or files?
This can be done by using IDE scopes. In Android Studio (at least 3.4) you can configure each inspection per scope. The idea is that you create a scope that contains all files you don't want to be spellchecked, and then switch Spelling inspection off for this scope, but keep it on for everything else.
Add a new scope in Settings / Appearance & Behavior / Scopes that contains all files which you want to exclude from spell checking. For example, this pattern covers all svg files: file:*.svg. In your case it could be like file:*/colors.xml||file:*/cache.xml. IDE will highlight all affected files by green, so you can check if you entered correct pattern.
Then set up Spelling inspection, so that it is OFF for your new scope and ON everywhere else.
Had the same problem with colors.xml
I couldn't find a way to disable the check for a certain file, but I could get rid of the spellcheck on the hex codes.
Click Analyze->Inspect Code.
Choose Whole Project and click OK.
The inspection tool window will open with the results.
You should be able to see the problematic hex codes under Spelling->typo.
Right click any one of them and choose Exclude.
Did the trick for me. HTH

Any way to apply an exclude list to the Visual Studio "Navigate To"-list?

I'd like to exclude code-generated files from the Edit > Navigate To-list which appears when hitting Ctrl+, in Visual Studio 2013, as these files are never to be modified by me manually and in those rare cases where I want to see the contents of them, I'll use the solution browser. Is there any way to do this? They produce a lot of noise in my search and greatly reduces the value of the Navigate to-function.
Edit Nov 2016: added an image for illustration in VS 2015. Very much an issue still. The first search hit is a .g.cs file in the obj-folder:
I assume that by "code-generated files" you are referring to files such as .designer that are also part of the solution (and found in solution explorer). After quite a bit of research into Navigate To I was unable to find any reference to such a configuration option. Currently there appears to be only 3 options for configuration (discussed in the MSDN blog below). A possible work around would be to leverage the built in filtering features of Navigate To (#, Capitalization and Whitespace) that are new to VS2013 as outlined in this MSDN blog:
http://blogs.msdn.com/b/mvpawardprogram/archive/2013/10/22/visual-studio-2013-navigate-to-improvements.aspx
Another article I found in my research: http://weblogs.asp.net/scottgu/archive/2009/10/21/searching-and-navigating-code-in-vs-2010-vs-2010-and-net-4-0-series.aspx
UPDATE: I use the ReSharper plugin and only after posting this answer realized there is a Filter results from generated files feature to exclude generated files and is discussed at the link below. Though it does not pertain to Navigate To, it may provide a satisfactory alternative:
http://www.jetbrains.com/resharper/webhelp/Reference__Options__Environment__Search_and_Navigation.html
UPDATE (12/1/2015): Now that some time has passed I decided to do a little more research and found a similar request posted on SO here. I found this to work pretty well, and VS will even save the list for you.

Visual Studio 2012 "Find in Files" searches far beyond the solution when "Entire Solution" is specified

While performing Find and Replace operations in Visual Studio 2012; using the Find in Files/Replace in Files dialog window, setting the "Look in" scope to "Entire Solution", and using Regular Expressions on all file types, Visual Studio is busy searching the WHOLE HARD DRIVE! Some of my searches take a very long time and when I look at the Visual Studio Status Bar, it shows the currently searched directory/file is something well outside of the solution folders - sometimes it is even searching the C:\Windows\System32 directory or similarly irrelevant locations.
Has anyone else seen this behavior? More importantly, does anyone have a solution to fix it, so my search and replace operations stick to the solution files and don't waste time searching the other million files on the computer?
I've not had it searching the whole drive, but I have had it return matches from files outside my project (this in VS 2010). In my case deleting the .suo file appeared to fix this issue.
My suspicion is that the files being searched are files I stepped into during a debugging session (or more accurately stepped out of my code into the calling code). Somehow these files are remembered and included in searches.
This wouldn't explain a full drive search, but could explain my "out of solution" results
I was having a similar problem with Visual Studio 2013 with Update 4 installed - in my case I was getting search results from files that had been in the Miscellaneous Files 'Project', even after removing them from Miscellaneous Files.
Deleting the .suo file from the solution directory solved the problem; however, doing so causes VS to forget which files you had open in the solution (and probably some other things).
Still occurring in Visual Studio Enterprise 2017, Version 15.8.6.
Deleting the .suo file (found in .\.vs\YourSolutionName\v15\) and rebuilding the solution fixed the issue.
I suspect it's known directory/targeted directory to search was being cached there because the Find Results would show up very quickly. Indicative of it not searching the "whole hard drive", or even my whole mapped workspace "Local Folder". Typically if I am performing a search on even a more parent branch in source control, it will take close to a minute.
For me the solution was to move the file .sln into the solution directory.

How to add binary diff viewer to tortise SVN & recommendations

I use tortiseSVN and frequently check in changes to binary files, does anyone know of a good diff visualizer and how to add it.
To answer the question in your title, there's information on such settings over at the TortoiseSVN site.
Basically:
Open settings
Expand 'External Programs'
Select 'Diff Viewer'
Configure in the right-hand pane.
As I commented, you have two different questions here, and the one asking for suggestions for binary diff tools has already been covered here on SO. I'd suggest you reference the the answers to that question to see if they are useful and target this question in one direction only.

Resources