Sublime Forum

Folder_exclude_patterns ignored if placed in Project settings

#1

If I correctly understood, I could use the folder_exclude_patterns in the project settings, which can also be set on a per-project basis.
This seems not to work as expected, since I tried to edit my .sublime-project file like this:

{
"folders":
[
	{
		"path": "PathToMyProjectRoot"
	}
],
"settings":
{
	"folder_exclude_patterns": ["DocSdd"],
}
}

and the “ignored” folder is still showing up in the project, and searched in the “find in files”.
If I write the same settings in the Preferences.sublime-settings file (in the User directory, of course), this is working.

Using Sublime 3143, but the same happens in 3155 (dev channel).
Is this behaviour (which is expected to work, according to the documentation), broken in one of the latest releases?
Or, am I missing something?

Thank you.

0 Likes

#2

The version of this setting that’s in the default preferences is a global setting that affects all projects.

You can use that setting in a project as well, but in that case it needs to be applied to the folder entry in the project that contains it instead of being in the settings object.

In your case, that would look like this:

{
    "folders":
    [
        {
            "path": "PathToMyProjectRoot",
            "folder_exclude_patterns": ["DocSdd"]
        }
    ]
}

The same is true for file_exclude_patterns as well, should you want to make it per-project.

Additionally you can also use folder_include_patterns and file_include_patterns in this context as well. Note however that when you use them, you’re explicitly telling Sublime to only add the folders and files that match the patterns you provide, and everything else is automatically excluded. You can then use them in combination with the exclude patterns to further redact files.

More info on this is available in the unofficial documentation on Projects.

0 Likes

#3

Thank you for your reply. Actually, this is working fine if configured this way
I noticed that the documentation is stating (about Settings) on binary_file_patterns

This setting must be used in a global Preferences.sublime-settings file, or in folder items in a .sublime-project file.

…but this is not actually working

1 Like