简体   繁体   English

Visual Studio 代码“files.exclude”不起作用

[英]Visual studio code “files.exclude” not working

Yesterday I added files.exclude to my user settings in visual studio code to hide .js and .map files and it worked correctly.昨天我在 Visual Studio 代码中将 files.exclude 添加到我的用户设置中以隐藏 .js 和 .map 文件并且它正常工作。 But today (and without restarting or closing code) it stopped working.但是今天(并且没有重新启动或关闭代码)它停止工作。

This is the full settings.json file这是完整的 settings.json 文件

// Place your settings in this file to overwrite the default settings
{
    "files.exclude": {
        "app/*.js": true,
        "app/*.map": true
    }
}

Anyone knows how to fix this?有谁知道如何解决这个问题?

我通过在每个排除之前添加“**/”来使其工作,我可能以不同的方式打开了项目并且没有注意到父文件夹已添加到项目结构中

You might have already got the answer but thought of posting as this might be a solution for others.您可能已经得到了答案,但考虑发布,因为这可能是其他人的解决方案。 Below worked for me.下面为我​​工作。

"**/app/*.js": {"when": "$(basename).ts"} or

"**/app/**/*.js": {"when": "$(basename).ts"}

I'm running VSCode 1.47.3 (in 2020) and this works well for typescript.我正在运行 VSCode 1.47.3(2020 年),这适用于打字稿。

"files.exclude": {
  "**/*.js": { "when": "$(basename).ts" }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM