SUBLIME PROJECTS FILE HACK

On this project I've been working on there are several components which could really be broken up and managed as individual Sublime projects.

I like to be able to search across several of them at once though so I've gotten into the habit of simple calling them all within one project.

{
    "folders":
    [
        {
        "name": "Project1",
        "path": "/C/inetpub/wwwroot/project1",
        "file_exclude_patterns": ["*.sublime-workspace"]
        }
        ,{
        "name": "Project2",
        "path": "/C/inetpub/wwwroot/project2",
        "file_exclude_patterns": ["*.sublime-workspace", "*.gitignore"]
        }
        ,{
        "name": "Project3",
        "path": "/C/inetpub/wwwroot/project3",
        "file_exclude_patterns": ["*.js","*.css"]
        }
        ,{
        "name": "Common",
        "path": "/C/inetpub/wwwroot/common/"
        }
    ]
}

This works fine but at other times I don't want to see all of them so I edit the project file to add or remove certain projects via commenting out code.

Being JSON however that damn comma always wreaks havoc when I save.

{
    "folders":
    [
        // {
        // "name": "Project1",
        // "path": "/C/inetpub/wwwroot/project1",
        // "file_exclude_patterns": ["*.sublime-workspace"]
        // }
        ,{
        "name": "Project2",
        "path": "/C/inetpub/wwwroot/project2",
        "file_exclude_patterns": ["*.sublime-workspace", "*.gitignore"]
        }
        // ,{
        // "name": "Project3",
        // "path": "/C/inetpub/wwwroot/project2",
        // "file_exclude_patterns": ["*.js","*.css"]
        // }
        ,{
        "name": "Common",
        "path": "/C/inetpub/wwwroot/common/"
        }
    ]
}

To get around this I setup a bogus 'project' that points nowhere:

{
    "folders":
    [
        { 
            // intentionally left blank 
        }
        // {
        // "name": "Project1",
        // "path": "/C/inetpub/wwwroot/project1",
        // "file_exclude_patterns": ["*.sublime-workspace"]
        // }
        ,{
        "name": "Project2",
        "path": "/C/inetpub/wwwroot/project2",
        "file_exclude_patterns": ["*.sublime-workspace", "*.gitignore"]
        }
    ]
}

Now I can easily comment or uncomment any of the projects below it without fear of forgetting to add, or remove a comma.

Published on Thursday, September 26 2013    

COMMENT / SHARE

About

Jim is a Senior Applications Engineer working at Red Hat. He slso likes motorcycles and keeping his quadcopter out of trees.