Sublime Forum

A way to specify root in Project Settings?

#1

I searched for this but can’t find out if there’s a syntax to specify the root level of the project in a sublime project file.

This is significant when you specify only certain folders to be shown, and then if you use the “Copy Path” function in the sidebar (via Sidebar Enhancements Plugin I believe), the path you get does not include the root folder just the folder that’s being shown

Or is this a problem with the sidebar enhancements package?

1 Like

#2

Just put “/” in your .sublime-project file.
It’s working for me.

1 Like

#3

[quote=“Electrodragon”]Just put “/” in your .sublime-project file.
It’s working for me.[/quote]

This apparently stops Reveal in sidebar function to work.

1 Like

#4

Use // to specify the project root. Here are some examples:

Project settings file:

{
    "folders":
    [
        {
            // **absolute path** to open a folder in a project
            "path": "/path/to/mainapp",
            // exclude only the "mainapp/node_modules" dir
            "folder_exclude_patterns": ["//node_modules"],
        },
        {
            // or **relative path** to open another folder in the project; 
            // the path is relative to the location of the 
            // "project_name.sublime-project" project file itself
            "path": "some_dir",
            // exclude only the "some_dir/path/to/excluded_folder" dir
            "folder_exclude_patterns": ["//path/to/excluded_folder"],
        },
    ],
}

See my answer on this here: How do I exclude a folder from the sidebar in Sublime Text permanently, specifying it relative to the open folder?

1 Like