Git status in File Explorer
Problem
Similar to what atom provides in the project explorer: 1. New files are displayed green. 2. Modified are displayed yellow/orange. 3. Ignored files are displayed transparent-ish. Thanks
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Implement Git File Decorations in VSCode File Explorer
The Visual Studio Code (VSCode) File Explorer does not natively support visual indicators for Git status of files. This limitation prevents users from easily identifying new, modified, and ignored files at a glance, similar to the functionality provided by other editors like Atom.
Awaiting Verification
Be the first to verify this fix
- 1
Install GitLens Extension
GitLens enhances the built-in Git capabilities of VSCode and provides additional features, including file decorations based on Git status.
bashcode --install-extension eamodio.gitlens - 2
Configure GitLens Settings
After installing GitLens, configure its settings to enable file decorations in the File Explorer. Open the settings (File > Preferences > Settings) and search for 'GitLens'. Ensure that 'GitLens: Show File Decorations' is enabled.
bash// No code snippet required - 3
Verify File Decoration Colors
Check the File Explorer to ensure that new files are displayed in green, modified files in yellow/orange, and ignored files are transparent. If the colors do not appear as expected, restart VSCode.
bash// No code snippet required - 4
Customize Decoration Colors (Optional)
If you wish to customize the colors for file statuses, you can do so by modifying the settings.json file. Add or update the following entries to set your preferred colors: 'gitlens.fileDecoration.newColor', 'gitlens.fileDecoration.modifiedColor', 'gitlens.fileDecoration.ignoredColor'.
json{ "gitlens.fileDecoration.newColor": "#00FF00", "gitlens.fileDecoration.modifiedColor": "#FFA500", "gitlens.fileDecoration.ignoredColor": "#D3D3D3" }
Validation
To confirm the fix worked, open a Git repository in VSCode and create a new file, modify an existing file, and add a file to .gitignore. Check the File Explorer to see if the new file is green, the modified file is yellow/orange, and the ignored file is transparent.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep