Sublime Forum

"binary_file_patterns" doesn't work?

#1

I’m trying to exclude minimized CSS and JS files from “find in files”. So, in my Preferences.sublime-settings I have:

	"binary_file_patterns":
	[
		"*.min.js",
		"*.min.css",
		"*.map"
	],

However, when I do a search with Ctrl+Shift+F, these files still show up in the search results.

Simply changing the label from "binary_file_patterns" to "file_exclude_patterns" works well, meaning the files disappear both from the folder sidebar, and from the search results. However, I would prefer to have these files show up in the sidebar.

Am I misunderstanding something? Or are my settings overruled somewhere?

0 Likes

#2

You’re definitely not misunderstanding "binary_file_patterns". Is there perhaps another entry in your settings called "binary_file_patterns"?

0 Likes

#3

Have you tried using an exclude filter in the Find in Files ? There is a ... button next to the Where field where you can find Add Exclude Filter. This basically defines file patterns which doesn’t count when you use FiF.

For your case, it will be -*.min.js, -*.min.css, *.map.

0 Likes

#4

@bschaaf This is the complete contents of my preferences file:

{
"file_exclude_patterns":
[
	"*.min.js",
	"*.min.css",
	"*.map"
],
// why doesn't this work:
"binary_file_patterns":
[
	"*.min.js",
	"*.min.css",
	"*.map"
],
"folder_exclude_patterns":
[
	"bower_components",
	"_svn",
	".vs",
	".git"
],
"font_face": "Fira Code",
"font_size": 11,
"highlight_line": true,
"hot_exit": false,
"ignored_packages":
[
	"Vintage"
],
"remember_open_files": false,
"show_encoding": true,
"theme": "Adaptive.sublime-theme"
}

Are there other settings or preferences that could override this?

0 Likes

#5

@UltraInstinct05 I know about that possibility, but since I often have different folders to search in, I would have to redefine my exclude filters every time…

0 Likes

#6

In ST3 if your Where: field includes an explicit directory, then all files are found inside of it even if they should otherwise be excluded by binary_file_patterns; this was resolved in build 4067.

So that might be something to check for, if you happen to be doing that in your search.

3 Likes

#7

Doesn’t seem to be an issue to me. You can always automate it to an extent.

0 Likes

#8

Awww, yeah that would be the case for me, most of my searches are within specific substructures (folders) of my projects. Not only is that regrettable in my situation, but that also is illogical looking at the name of the settings (searching within a specific folder doesn’t influence if a file is “binary” or not), and it is inconsistent with the behaviour of the file_exclude_patterns setting (actually, I would find it more understandable if that setting’s behaviour was changed when specifying a folder). :slightly_frowning_face:

I did some tests, and you are correct. Specifying a search folder negates the “binary_file_patterns” setting.

0 Likes