我正在尝试排除Visual Studio代码中的Explore选项卡上的几个文件夹。为此,我添加了以下jsconfig。Json到我的项目的根:
{
"compilerOptions": {
"target": "ES6"
},
"exclude": [
"node_modules"
]
}
但是node_modules文件夹在目录树中仍然可见。
我做错了什么?还有其他选择吗?
我正在尝试排除Visual Studio代码中的Explore选项卡上的几个文件夹。为此,我添加了以下jsconfig。Json到我的项目的根:
{
"compilerOptions": {
"target": "ES6"
},
"exclude": [
"node_modules"
]
}
但是node_modules文件夹在目录树中仍然可见。
我做错了什么?还有其他选择吗?
当前回答
在VSCode的新版本中,这移动到一个特定于文件夹的配置块。
转到文件->首选项->设置(或在Mac代码->首选项->设置) 选择文件夹设置选项卡
然后添加一个“files”。块,列出你想要排除的目录glob:
{
"files.exclude": {
"**/bin": true,
"**/obj": true
},
}
其他回答
如果这些文件定义在.gitignore,你可以通过以下方法排除它们:
文件->首选项->设置(或Mac代码->首选项->设置) 功能->搜索->检查使用忽略文件
我设法通过禁用验证来删除错误:
{
"javascript.validate.enable": false,
"html.validate.styles": false,
"html.validate.scripts": false,
"css.validate": false,
"scss.validate": false
}
Obs:我的项目是一个PWA使用StyledComponents, React, Flow, Eslint和更漂亮。
在VSCode的新版本中,这移动到一个特定于文件夹的配置块。
转到文件->首选项->设置(或在Mac代码->首选项->设置) 选择文件夹设置选项卡
然后添加一个“files”。块,列出你想要排除的目录glob:
{
"files.exclude": {
"**/bin": true,
"**/obj": true
},
}
有一个资源管理器排除扩展就是这样做的。https://marketplace.visualstudio.com/items?itemName=RedVanWorkshop.explorer-exclude-vscode-extension
它添加了一个选项来隐藏当前文件夹/文件到右键菜单。 它还添加了一个垂直选项卡隐藏项目到资源管理器菜单,在那里您可以看到当前隐藏的文件和文件夹,并可以轻松切换它们。
您可以配置模式来隐藏资源管理器和搜索中的文件和文件夹。
打开VS用户设置(主菜单:File > Preferences > Settings)。这将打开设置界面。 搜索文件:排除在搜索的顶部。 根据需要使用新的glob模式配置用户设置。在本例中,添加这个模式node_modules/,然后单击OK。模式语法非常强大。您可以在跨文件搜索主题下找到模式匹配的详细信息。
{
"files.exclude": {
".vscode":true,
"node_modules/":true,
"dist/":true,
"e2e/":true,
"*.json": true,
"**/*.md": true,
".gitignore": true,
"**/.gitkeep":true,
".editorconfig": true,
"**/polyfills.ts": true,
"**/main.ts": true,
"**/tsconfig.app.json": true,
"**/tsconfig.spec.json": true,
"**/tslint.json": true,
"**/karma.conf.js": true,
"**/favicon.ico": true,
"**/browserslist": true,
"**/test.ts": true,
"**/*.pyc": true,
"**/__pycache__/": true
}
}