'How to hide autogenerated files from VS code
I want to hide auto generated dart files like .g.dart
, .freezed.dart
from vs code project. How to do that?
Solution 1:[1]
TL;DR
Type Ctrl/Cmd + Shift + p
, choose Preferences: Open Settings (JSON)
or Preferences: Open Workspace Settings (JSON)
and add:
"files.exclude": {
"**/*.freezed.dart": true,
"**/*.g.dart": true
},
You can add more patterns if you like. Here you can find more information about the patterns.
More info
You can configure this in your workspace or user settings:
Open settings: Ctrl/Cmd + Shift + p
and search for 'Preferences: Open Settings'. You can choose from 'Workspace Settings' or your 'User Settings', depending on if you want to exclude the files just in your current project (workspace) or for all projects. And you can choose if you want to use the UI tool or to modify the settings json file manually.
Using the UI tool:
Search for files.exclude
and you can add patterns you want to hide in the project explorer. In your case add **/*.freezed.dart
and **/*.g.dart
, but you can exclude any pattern you like.
Editing the json file manually:
Type Ctrl/Cmd + Shift + p
and search for 'Preferences: Open Settings (JSON)' or Preferences: Open Workspace Settings (JSON)
. Again, depending on if you want to exclude the files just in your current project (workspace) or for all projects.
Add this part to the json file:
"files.exclude": {
"**/*.freezed.dart": true,
"**/*.g.dart": true
},
Or add just the pattern lines, if files.exclude
is already present in the settings.json file.
Solution 2:[2]
create a folder
.vscode
create
settings.json
put this:
{
"files.exclude": {
"**/*.freezed.dart": true,
"**/*.g.dart": true
},
}
this make local configuration in your project.
Solution 3:[3]
"On Mac. Open VSCode, Type Shift+Command+P, Preferences: Configure, Language Specific Settings, Choose the Language (Dart), Then add to file "
"files.exclude": { "/.git": true, "/.svn": true, "/.hg": true, "/CVS": true, "/.DS_Store": true, "/*.g.dart":true, }
Save
Now, you don't see the *.g.dart files.
Solution 4:[4]
In v1.67 you can create an entry in the
Explorer > File Nesting: Patterns
setting like so:
*.dart
$(capture).g.dart, $(capture).freezed.dart
explorer.fileNesting.enabled
: Controls whether file nesting is enabledexplorer.fileNesting.expand
: Controls whether file nests show as expanded by defaultexplorer.fileNesting.patterns
: Controls how files get nested
In addition the Explorer: Sort Order
setting has a new option:
foldersNestsFiles
: Files and folders are sorted by their names. Folders are displayed before files. Files with nested children are displayed before other files.
sortOrder.foldersNestsFiles
See also v1.67b Release Notes: File Nesting
Make sure you have Explorer > File Nesting: Enabled
true
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | cumul |
Solution 2 | Lucas Breitembach |
Solution 3 | Carlos |
Solution 4 |