Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the .sublime-project settings as folder_exclude_patterns accept ./ as the current folder #1897

Closed
evandrocoan opened this issue Sep 11, 2017 · 2 comments

Comments

@evandrocoan
Copy link

Currently doing:

{
    "folders":
    [
        {
            "path": ".",
            "folder_exclude_patterns":
            [
                "Settings",
            ],
        },
    ]
}

Will make Sublime Text to ignore all folders named Settings anywhere on the project, not only the root folder Settings. Therefore, to ignore the folder:

image

But not the nested folder:

image

When we creating a .sublime-project as:

{
    "folders":
    [
        {
            "path": ".",
        },
    ]
}

Currently we need to manually figure out what is the folder where the .sublime-project is currently on then we need to prepending its name as Data/ on the settings folder_exclude_patterns entries so we can ignore the root folders, without ignoring the nested folders with the same name.

For example, supposing the current folder . name is Data, we need to use:

{
    "folders":
    [
        {
            "path": ".",
            "folder_exclude_patterns":
            [
                "Data/Settings",
            ],
        },
    ]
}

Where Data is the name of the current folder . where the .sublime-project is on. Appending * on settings also works, but appending /* do not work as * to ignore the folder Settings.

The folder_exclude_patterns should accept the entry . to represent the current folder as in:

{
    "folders":
    [
        {
            "path": ".",
        },
    ]
}

Hence, to ignore some root folder we would use:

{
    "folders":
    [
        {
            "path": ".",
            "folder_exclude_patterns":
            [
                "./Settings/*",
            ],
        },
    ]
}

To ignore a root folder not depending on the current folder Data name.


Related:

  1. folder_exclude_patterns is excluding all project folders named Settings #1895 folder_exclude_patterns is excluding all project folders named Settings
  2. Exclude folder in project root (only) #1115 Exclude folder in project root (only)
  3. folder_exclude_patterns relative to project root robcowie/SublimeTODO#77 folder_exclude_patterns relative to project root
@tidde
Copy link

tidde commented Apr 17, 2019

I'd just like to point out that it may not be entirely obvious whether ./ would be the folder of the .sublime-project file, or the path; in the example above they coincide, but I tend to put my project settings in a subdirectory to avoid clutter at the project root, and then it makes a difference.

In view of folder_exclude_patterns sitting next to path, it would make sense to have the same interpretation of relative paths. On the other hand, it seems a bit silly and error prone to me that one would have to repeat the value of path as a prefix of any folder_exclude_patterns that shouldn't match directories at any depth.

My preference would be to interpret folder_exclude_patterns relative to path, so that I could exclude the build directory at the project root like this:

{
  "folders":
  [
    {
      "path": "../..",
      "folder_exclude_patterns":
      [
        "./build",
      ]
    },
  ]
}

To be clear: what I would not like to do is setting the exclude pattern to "../../build". More generally, there should never be a reason to specify folder_exclude_patterns starting with .., since it only makes sense to restrict the directory subtree of the current path.

@wbond
Copy link
Member

wbond commented Feb 14, 2020

As of build 4067, // can be used to anchor a pattern to a project folder. Thus Settings would change to //Settings and ./build (which is invalid) could be accomplished via //build.

@wbond wbond closed this as completed Feb 14, 2020
@wbond wbond added this to the Build 4067 milestone Feb 14, 2020
@wbond wbond added the R: fixed label Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants