IntelliJ File mask not working on simple excluding file pattern! Why? - search

Follows this page https://www.jetbrains.com/help/pycharm/2016.1/find-and-replace-in-path.html?origin=old_help#mask , it should be able to exclude many files using "!" symbol in front of the regular pattern like: *.java, when doing text search inside IntelliJ projects.
On my project, when I fired Ctrl + Shift + F to do text search for string xyz. There's over 100+ results return in both *.ftl and *.java files. I tried to reduce the results on only ftl files by changing the "File mask(s)"-Option to "!*.java" . But it did not work! The result list is empty!
Googling on the excluding file pattern results in creating custom file filters for each particular search, which I don't want to maintain!
Do I miss something here or IntelliJ is just bad on this function (I'm using IntelliJ 15)? With Eclipse, the "File mask" was amazing!

You have to use
!*.java instead of !.java

As for IDEA 2019.1 Ultimate, it works for me(exclude with !*.yml or anything else).
If it does not in yours, as you only as .ftl file to exclude, why not add mask as *.java?
PS: what does not work is exclude some path, like "all files under out/ folder". With !out/* or anything ales it does not work.

Forget about File Mask and use Scope:
In Scope the options are unlimited where you can select folder include/exclude files or folders.

Excluding file paths in the Find in Path dialogue was not added until IntelliJ 2016.1 per this IntelliJ forum response.

Related

Sublime Text file_exclude_settings not excluding file from search results

I have the file
/Users/maxpleaner/Hover/website/ngapps/account/account.partials.js
that I want to exclude from my search results.
Present in the .gitignore is
ngapps/**/*.partials.js
which I would like to ignore via Sublime settings also. But at minimum, being able to exclude all .partials.js files would do the trick.
I tried putting "ngapps/**/*.partials.js" and */partials.js in my file_exclude_settings, but neither one of them actually works to exclude the file from the search results.
What am I doing wrong here? Thanks in advance for your help.
The problem was that I had it as file_exclude_settings but it's actually supposed to be file_exclude_patterns.
facepalm!

How to search a string in files partially matching "name"

I'm looking for a class which is defined in a Koin module file somewhere in my project. The filenames of all those Koin modules are "*Module.kt".
I could do cmd+shift+F to search for "TheClass" everywhere, but that gives me too many results and I don't want to go through all of them manually. I'd like to only search in files with the above mentioned filename pattern.
Another thing I could do is to use alt+F7 or cmd+B on the TheClass itself to see its usages, but again that leads to too many results.
Is there a way (using Android Studio) to search smarter for this?
I found out that when using "Find in Path" with cmd+shift+F you can put more in the file mask than just "*.kt". I've changed the file mask to "*Module.kt" and got the desired result.

How to search only in currently open files in vscode?

I usually work on larger projects with many files that would contain the search query. So I would open the files I want to modify and do a find/replace across all currently opened files. Can this be done in vs code?
The feature I'm looking for is implemented in Notepad++, but I'd prefer not to have to switch editors for this task.
For me somehow it works just by typing ./ in the files to exclude field.
The ability to search only in the open editors is in the Stable Build v1.55.
As you can see, the icon is at the end of the files to include input so you will have to have that showing (click the three dots ... just below the search options if files to include is not already showing).
"Search: target particular set of files #20530" located here: https://github.com/Microsoft/vscode/issues/20530
Is tracking a search "scope" such as "all open files".
Hit Ctrl + Shift + F and enable the icon at the end of the 'file to include' text field
I don't think there's a way to do this. You can make a feature request on github. I think an extension could do it though.
There is a checkbox for this in the "files to include" field since version 1.55 (march 2021).
The answer was already mentioned (and accepted above) indeed typing ./ in the files to exclude box of the search window will allow you to only search in open files.
However the response mentioned that he was unsure why this worked. VSCode allows you to exclude all files in a directory by writing the directory in the exclude box. The directory . is the directory where VSCode is opened ie the root directory. The filter ./ excludes all files in the VSCodes root directory so all files are excluded. However opened files ignore any exclude filter. So if you exclude all files only the opened files will be searched.
The best way to find something you are searching for within a specific file in vs code would be:
Ctrl + p then pressing # on the search bar.
It will give you a list of all functions on the file, which makes it easier to track something down.
As an alternative to using Visual Studio Code itself, you can just search the file contents within the folder where unsaved files open in Visual Studio Code are located. This would be in one of these locations depending on which OS you are running:
Linux: /tmp/ (someone else running Linux can verify this)
macOS: ~/Library/Application\ Support/Code/Backups/
Windows: %APPDATA%\Code\User\
This extension is what I use for this purpose.
You may need to change the keybinding if there is a conflict.

Ignore R.java files in Find results

When I do a Find in Path (Ctrl+Shift+F), I often get results under "Usages in Generated Code" in R.java files. When I'm searching my code, I want to do just that: search my code. Not files generated by my code.
Is it possible to get the find dialog to not show any R.java files in the results? The only results I want are those under "Found Occurrences"
Thank you!
Android Studio (like its progenitor IntelliJ) allows you to define a custom scope to help you exclude intermediates files when searching.
Here are the steps I use to set this up:
Bring up Find in Path dialog (Ctrl+Shift+F on my machine).
In the Scope area, select the Custom radio button. Then tap the "..." button on the right side of the dropdown. This brings up the Scopes dialog.
Click the "+" button on the left side of the Scopes dialog, which will bring up the Add New Scope dialog. Name it "ExcludeIntermediates".
In the Pattern field, paste in the following pattern and click OK:
!file:*intermediates*/&&!file:*generated*/
This pattern excludes R.java files and other intermediates such as layout files in exploded-aar and AndroidManifest.xml copies in filtered_manifests folders.
This pattern excludes R.java files and other intermediates such as layout files in exploded-aar and AndroidManifest.xml copies in filtered_manifests folders.
ignores R.java files
ignores all *.java files generated by Android Annotations (i.e. *_.java files)
includes strings.xml, dimens.xml, styles.xml, attrs.xml, colors.xml files
includes all xml files in layout/* path
!file:*intermediates*/&&!file:*generated*/&&file:*java&&!file:R.java&&!file:*_.java||file:*strings.xml||file:*dimes.xml||file:*styles.xml||file:*attrs.xml||file:*colors.xml||file:*layout/*xml&&!file:*build/*xml
Combined from:
https://stackoverflow.com/a/32238593/1815624
&
https://stackoverflow.com/a/32680493/1815624
To search multiple modules but ignore R.java, you could use the following mask IF you don't have any other single character file names in your project:
☑ File mask(s): ??*.*
i.e. Limit results to filenames with at least 2 characters + any extension.
If you're using Android Studio, a simple way of achieving this is to set the Scope to be Directory (rather than Whole Project) and set this directory to be your src folder - since R.java appears under build/generated it won't appear in results there.
I use "custom scopes" in Android Studio to ignore R.java files. Others had described how to create/save a "shared custom scope" which can later be uploaded to a git repository. I'm just gonna share my custom scope string which:
ignores R.java files
ignores all *.java files generated by Android Annotations (i.e. *_.java files)
includes strings.xml, dimens.xml, styles.xml, attrs.xml, colors.xml files
includes all xml files in layout/* path
file:*java&&!file:R.java&&!file:*_.java||file:*strings.xml||file:*dimes.xml||file:*styles.xml||file:*attrs.xml||file:*colors.xml||file:*layout/*xml&&!file:*build/*xml
You could just avoid all the generated files from your project, as Mike Evans suggest in this tweet
You just need add a scope excluding the pattern mentioned:

SublimeText3 - Find all files without a string?

I've looked around quite a bit for an answer to this, but I cannot seem to find what I need. Is it possible with SublimeText3 > Find in Files to do a search for all files that DO NOT include a string?
I've tried toggling the Regular Expressions button beside "Find:" and entering a value, but I'm not a regex pro, so I may be doing it wrong?
For example, I want to find all files in a designated folder that DO NOT have the following string:
social-links
Any help would be greatly appreciated.
Search for all files in your directory in question (for anything, like a space or the letter e...assuming every file has a space or letter e!), and copy all those file-paths to a new file.
Search for all files with the word, and paste that path-list into a second file.
Sort both files, then compare them to see which lines--which paths--are missing from the has-the-word file. Those are the ones you want.
As far as a single find-in-files search, I don't see how you would do that in Sublime or any other basic text editor. Here is some more information:
https://unix.stackexchange.com/questions/26836/how-can-i-find-all-files-that-do-not-contain-a-text-string
Find files that does not contain a string
How to find all files that do NOT contain specific string in windows environment Visual Studio or any other IDE?
Good luck!

Resources