Natizyskunk / vscode-sftp

Super fast sftp/ftp extension for VS Code
Other
373 stars 68 forks source link

configuration feature: files whitelist #462

Open Be1zebub opened 5 months ago

Be1zebub commented 5 months ago

Is this a similar or duplicate feature request?

Is your feature request related to a problem? Please describe. Nope, just QOL

Describe the solution you'd like I would like to request the addition of a file whitelisting feature, I propose an implementation based on the .gitignore principle - this would work as a replacement for the existing ignore parameter, allowing you to ignore files and add them to the whitelist. It would also be cool to be able to link an existing one .gitignore of the project to sftp extension.

Describe alternatives you've considered ignore configuation option, but its boring to configure blacklist - whitelist or gitignore like is much better.

Does this project help you?

fluse1367 commented 3 months ago

I just stumbled upon this because a whitelist is exactly what I need as well :)

Turns out you can achieve this using the ignore option as the used parser implements the gitignore spec (2.22.1); So, you you can just "exclude all" and then "unexclude" certain files by negating the pattern (see the gitignore pattern format):

"ignore": [
    "/*",                 // exclude all
    "!/whitelisted-path", // negate the pattern to unexclude
    "!*.yml"              // i.e. unexclude any yml file
]

@Natizyskunk maybe you can just mention that in the docs real quick :) perhaps just link to the spec? if you want i can also sketch up a PR for that