1
votes

I am developing a new extension for OpenCart using VSCode as IDE. The root folder is the workspace folder, and I want only to change some files. I set the .gitignore file to ignores all files except the files I want to work on. This is my .gitignore file

.htaccess.txt
config.php
php.ini
index.php
.vscode/*

#ignore all
*/*

Then I added my working files:

git add path/to/file.php -f

everything is ok. The problem is VSCode shows every file in the workspace.

I want to view only my working files. I tries this trick:

enter image description here

It is good but still not working very well, as I have to open each folder to let VSCode find those files.

Is there any way to let VSCode shows only the files included in git repo? VSCode highlights those files by the way.

Or at least is there any way to hide all files except specific files?

Thanks

1

1 Answers

0
votes

You can define which files you want VSCode to hide in your workspace.

In folder .vscode, which folder you're ignoring in git, you add a file settings.json to define which settings you want to use at your local workspace. VSCode support option files.exclude to exclude these files in workspace.

This is example for your situation:

{
    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,

        ".htaccess.txt": true,
        "config.php": true,
        "php.ini": true
    }
}

You can see how it works in the following picture

enter image description here