npx / vscode-hide-gitignored

19 stars 7 forks source link

Plugin incorrectly uses the name of the workspace as the name of the folder #12

Open laurent22 opened 4 years ago

laurent22 commented 4 years ago

I have my code-workspace file setup like this:

{
    "folders": [
        {
            "name": "Joplin",
            "path": "."
        },
        {
            "name": "Joplin Nextcloud App",
            "path": "D:/nextcloud/apps/joplin"
        },
    ],
    "settings": {
        "files.exclude": {
            // ...
        },
    },
}

So there are two folders, one that's just the current directory . and another one which points to another directory. When I run the Gitignored command, it adds the files like this:

"settings": {
    "files.exclude": {
        "Joplin/node_modules",
        "Joplin/......",
    },
},

So it prefixes all the path with "Joplin/", but that doesn't work because it's not a path but just a workspace name (which can be anything).

For now I've solved it by renaming my workspace to "." like so:

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

Not ideal but at least it works as in that case it sets the paths as ./node_modules etc.

So for the plugin I think the solution would be to take the value from the "path" key, and not from the "name" one.