How to search for files in different directories recursively in VSCode? - visual-studio-code

Visual Studio Code (as of version 1.41.1) is obviously very limited in regard of its file search. It seems to only allow to either search in folders recursively or in specific files, but it doesn't allow both.
Search in folders recursively
path/to/folder/ searches in any directories within subpaths matching path/to/folder including all subdirectories with no restriction in file names.
./path/to/folder/, ./path/to/another/folder searches in the directories with the paths path/to/folder and path/to/another/folder relative to the project's root directory.
Search in files
foo.bar searches in all files named foo.bar.
*.foo, *.bar searches in all files with the extensions foo or bar.
./path/to/folder/*/*.foo searches in all files with the extension foo that lie in a direct subdirectory of path/to/folder/ relative to the project's root directory.
Search in folders recursively and filter by file name
So, how to combine these two searches, i.e. filter the search by file names but search in specific directories with all their subdirectories?
In other editors like Eclipse you normally have two different fields for file names and folders, making it easy to specify them individually and avoid having to repeat yourself for multiple folders and file names. Therefore I have already created an enhancement request in the VSCode bug tracker asking to add a separate field for the folder.

In my testing, using the globstar does provide the functionality you desire.
https://github.com/isaacs/node-glob#glob-primer:
** If a "globstar" is alone in a path portion, then it matches zero
or more directories and subdirectories searching for matches. It does
not crawl symlinked directories.
So that ./path/to/folder/**/*.foo for example searches within all subdirectories of folder no matter how deep within files with the foo extension.
Same at https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options:
** to match any number of path segments, including none

Related

how to limit search to certain folder AND certain file types (more than one) in visual studio code?

consider the following files and folders structure:
head.html
folder1
1.css (this file is inside "folder1")
1.html
1.php
folder2
1.css
1.html
1.php
subfolder2 (this is a subfolder inside "folder2")
1.css
1.html
1.php
deepsub2 (a folder inside "subfolder2" that is inside "folder2")
1.css
1.html
1.php
to clarify the structure:
"folder1", "folder2", "subfolder2" and "deepsub2" are folders.
all the rest are files.
"1.css", "1.html" and "1.php" under that appear under a folder, for example "folder1" are inside
that folder.
"head.html" is in the root folder.
"subfolder2" is a folder inside "folder2" and "deepsub2" is a folder inside "subfolder2".
What i'm trying to do is search the word "viewport" in "folder2" and anything beneath it (including its subfolders), which means I don't want search in other folders (folder1 for example) or the root (head.html for example)
I also want to limit the search for file types: .html and .css
I DON'T want to specifically exclude .php as a file type because consider that sometimes I don't know what other file types there are in the structure and they can be t0o many to exclude, so I want to only to use a list of file types to include rather.
after reading the docs: https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options
the best I could come up with is using the following in the "files to include" input:
./folder2/**/*.css,./folder2/**/*.html
but it doesn't seem efficiant enough because i'm using the "folder2" path part for every file type.
is there a better way?
I'm using VScode Version: 1.65.0 by the way
This should work:
./folder2/**/*.{css,html} NO spaces in the {...} extensions or it won't work
from https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options:
{} to group conditions (for example {**/*.html,**/*.txt} matches
all HTML and text files)

What is the usage of blacklist.txt in pythonforandroid (p4a)?

In the documentation of pythonforandroid, at https://python-for-android.readthedocs.io/en/latest/buildoptions/, there is a build option described called blacklist.
--blacklist: The path to a file containing blacklisted patterns that will be excluded from the final APK. Defaults to ./blacklist.txt
However, not a word can be found anywhere about how to use this file and what exactly the patterns are supposed to represent. For instance, is this used to exclude libraries, files, or directories? Do the patterns match file names or contents? What is the syntax of the patterns, or an example of a valid blacklist.txt file?
This file should contain a list of glob patterns, i.e. as implemented by fnmatch, one per line. These patterns are compared against the full filepath of each file in your source dir, probably using a global filepath but I'm not certain about that (it might be relative to the source dir).
For instance, the file could contain the following lines:
*.txt
*/test.jpg
This would prevent all files ending with .txt from being included in the apk, and all files named test.jpg in any subfolder.
If using buildozer, the android.blacklist_src buildozer.spec option can be used to point to your choice of blacklist file.

I have mutiple folders I want to include in doxywizard

I have mutiple folders I want to include in doxywizard. Any Idea how can I do that? Currently If I select folder with multiple subfolder in it and when I run doxygen, It is not showing me any output.
When having specified just folders in the INPUT tag the files here are handled but not the files in subdirectories. For the later ones one needs the RECURSIVE tag (from the documentation):
RECURSIVE
The RECURSIVE tag can be used to specify whether or not subdirectories should be searched for input files as well.
The default value is: NO.

How to include specific directories in gtags.conf file

I work on a big project and want to only get the tags for some of the directories.
How do I tell gtags to only parse these directories and maybe "exclude" some sub directories within the ones specified?
I looked online but there is not enough documentation on how to construct or modify a gtags.conf file.

list files under a directory excluding hidden files and without going through sub-folders

is there a way to list (NSLog) file names under a folder (named downloads that is located under the documents directory of my app) with the following conditions met:
1) exclude hidden files (such as .DS_Store files)
2) do not search in sub-folders (i do not want the enumerator to be recursive).
thank you so much in advance.
EDIT:
3) do not list sub-folders' names.
Use NSFileManager's enumeration with options and pass the appropriate flags, which are NSDirectoryEnumerationSkipsHiddenFiles and NSDirectoryEnumerationSkipsSubdirectoryDescendants
This is from the docs: