Answers:
workspace settings
标签将此代码添加到settings.json
右侧显示的文件中:
// Place your settings in this file to overwrite default and user settings.
{
"settings": {
"files.exclude": {
"**/.git": true, // this is a default value
"**/.DS_Store": true, // this is a default value
"**/node_modules": true, // this excludes all folders
// named "node_modules" from
// the explore tree
// alternative version
"node_modules": true // this excludes the folder
// only from the root of
// your workspace
}
}
}
如果选择文件->首选项->用户设置,则为当前用户全局配置排除文件夹。
"**/BACKUP/": true
和没有最后一个斜杠一样好/坏。
false
为覆盖默认值。
files.exclude
密钥属于内的settings
的关键code-workspace
文件。
在较新版本的VS Code中,您导航到设置(Ctrl+ ,),并确保选择右上角的工作区设置。
然后添加一个files.exclude
选项以指定要排除的模式。
search.exclude
如果您只想从搜索结果中排除文件,而不是从文件夹资源管理器中排除文件,则也可以添加。
Workspace Settings
files.exclude
在内部settings:{ ... }
,否则它会抱怨该属性的行未知。有一个第三个 “文件夹设置”选项卡(.vscode / settings.json),其中在最外面的大括号工作。
settings.json
:{}
图标以打开settings.json
:
将排除的文件夹添加到中files.exclude
。还要检查一下search.exclude
,files.watcherExclude
因为它们可能也很有用。此代码段包含其说明和默认值:
{
// Configure glob patterns for excluding files and folders.
// For example, the files explorer decides which files and folders to show
// or hide based on this setting.
// Read more about glob patterns [here](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options).
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true
},
// Configure glob patterns for excluding files and folders in searches.
// Inherits all glob patterns from the `files.exclude` setting.
// Read more about glob patterns [here](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options).
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true
},
// Configure glob patterns of file paths to exclude from file watching.
// Patterns must match on absolute paths
// (i.e. prefix with ** or the full path to match properly).
// Changing this setting requires a restart.
// When you experience Code consuming lots of cpu time on startup,
// you can exclude large folders to reduce the initial load.
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true
}
}
有关其他设置的更多详细信息,请参见官方settings.json
参考。
确实有这个Explorer Exclude扩展程序可以做到这一点。https://marketplace.visualstudio.com/items?itemName=RedVanWorkshop.explorer-exclude-vscode-extension
它在右键菜单中添加了一个隐藏当前文件夹/文件的选项。它还向浏览器菜单添加了一个垂直选项卡“ 隐藏的项目”,您可以在其中查看当前隐藏的文件和文件夹,并可以轻松地对其进行切换。
我设法通过禁用验证来消除错误:
{
"javascript.validate.enable": false,
"html.validate.styles": false,
"html.validate.scripts": false,
"css.validate": false,
"scss.validate": false
}
观察:我的项目是使用StyledComponents,React,Flow,Eslint和Prettier的PWA。