Sublime Forum

*.sublime-project: folder_exclude_patterns

#1

Hi,

Is there a way to cause folder_exclude_patterns to be anchored to the root directory of the project?

For example, if I have a project directory like this:
this

  • that
    . + theOther
    that
    theOther

I would like to be able to exclude ‘./that’ or ‘./theOther’ without excluding the children of ‘this.’

Anyone know how?

Thanks.

1 Like

How to Exclude Folder Path Only from Root of Project
How include a file from a excluded folder in my .sublime-project?
#2
"folder_exclude_patterns": "root_dir/that","root_dir/theOther"]

where root_dir is the name of the root folder

1 Like

#3

Nice! Will try that right away!

Thanks.

1 Like

#4

This works nicely, thank you!

1 Like

#5

I’m having a problem with it again.

I have two folders

"folder_exclude_patterns": 
    "workspace/something",
    "workspace/something-else",
    ...
]

If I want to have “something-else” show up in the side bar, I comment it out and it won’t show unless I also comment out “something”.

I can’t figure out what regex spec is being used here. I’ve tried \b word boundary for Java, I’ve tried >, $, $, none of that works.

Actually what I would like to find is an end-of-line anchor.

Thanks.

1 Like

#6

I believe it’s not really regex. So no anchors or any of that fun stuff.
Pretty sure the only wildcards that work here are “*” and “?” (standard OS path wildcards).

The behavior you encountered does seem like a bug though, or at the very least an inconsistency and undesirable feature.
I mean, if you just use “something”, it will actually leave “something-else” visible. But, it will hide all “something” dirs too, for instance “foo/something”, which makes sense but is not good in your first post case.
But I see no logical reason why “bar/something” should hide “bar/something-else” as well. If I wanted that, I would expect to use “bar/something*”

So unless that gets fixed/changed, you have two options - 1) adopt a better folder naming scheme so you don’t have this problem (for example, prepend . to folders you want to hide, Linux style), 2) decide on the least of the two negatives and roll with that.

2 Likes

#7

Ya I thought it was a bug too.

If it’s not a regex, then it should automatically anchor to the end of the file name if there’s no explicit wildcard.

Unfortunately I’m not in control of the folder names.

I’m trying to use ST2 as a single editor across multiple projects. Some of them start with the same characters. The projects almost all use the same framework so there are massive matches between them, so I want to be able to comment out lines in this file to tell ST2 to ignore any project I’m not interested in at the moment. It’s been amazingly good with that, except for these name collisions.

My “safe” alternative is go back to one .sublime-project per development project, and one window per project. It sucks, but until such time as this bug gets fixed I guess it’s all I can do.

1 Like

#8

Is this automatically entered as a bug, or do I need to do that somewhere?

1 Like

#9

I have the same problem with similar directory names.
I hope developer reads this topic and fix this bug.
Maybe it is already fixed in Sublime Text 3 beta?

1 Like

#10

I finally got tired of it and made a hack.

Make a symbolic link to the ‘something-else’ in my example above, which will not match to any of the other patterns you have.

It’s dirty but it works for most of my use cases.

It’s crazy, this is just a one-line fix.

1 Like

#11

I’m trying to use Sublime 3 build 3059.

It seems to me that this feature is missing.
I cannot find documentation anywhere on how to make this work,
and this is one of the reasons I prefer free TextMate on Mac to Sublime.

I’m unwilling to specify the directories to skip each time in the search panel.
In my case, I want to skip these directories:

  • admin
  • amd
  • bower_components
  • commonjs
  • decl
  • doc
  • generated
  • log
  • node_modules
  • patch
  • reports
  • schema

Am I missing the documentation or is the feature missing?

1 Like

#12

@psnider,

It’s still here. You need a file with a .sublime-project suffix.

I do my work at the workspace level, so I have a bunch of git repositories or other projects which are checked into some sort of source control system (and so shared between users) and then at the same level as these folders I have a ‘master.sublime-project’ and a ‘master.sublime-workspace’

Here is a chopped-down version of my master.sublime-project.

Note that there is an excluded folders section and an excluded files section. They’re different.

{
    "folders":
    [
        {
            "path": ".",
            "folder_exclude_patterns": [
                // "head/settings",  // I want to see my settings folder so this is commented out.
                "head/dbmigrations",  // I don't want to see dbmigrations folder so it's not commented.
                "head/hello",

                // Miscellaneous
                "head/*.broken", // Any time I have valuable changes in a broken project I rename it to something.broken and check out fresh.
                "head/documentation",
                "head/shiro", // experimental shiro project.

                // OTHER STUFF.
                "akismet",
                "node_modules",
                "target*",
                ".grails",
                "lib",
                ".metadata",
                ".plugin-meta",
                "*.swp"
            ],
            "file_exclude_patterns":[
                "._*", // you need to specify this *again*
                "*.bak",
                "*.sample",
                "*.tar",
                "*.tgz",
                "*.zip",
                "*.sublime-workspace",
                ".gitignore",
                ".gitattributes",
                ".keystore",
                ".editorconfig",
                ".jshintrc",
                "stacktrace.log",
                "*.tmproj",
                ".classpath",
                ".project"
            ]
        }
    ]
}
2 Likes