Hide .js.map files in Visual Studio Code

后端 未结 12 2154
生来不讨喜
生来不讨喜 2020-11-30 16:19

I am working on a typescript project in Visual Studio code and would like to hide the .js.map (and maybe even the .js) files from appearing in the

12条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 17:05

    When you are working with TypeScript, you often don’t want to see generated JavaScript files in the explorer or in search results. VS Code offers filtering capabilities with a files.exclude setting (File > Preferences > Workspace Settings) and you can easily create an expression to hide those derived files:

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

    Similarly hide generated .map files by:

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

    So you will have a configuration like in:

    settings.json

    // Place your settings in this file to overwrite default and user settings.
    {
        "files.exclude": {
            "**/*.js": { "when": "$(basename).ts"},
            "**/*.js.map": { "when": "$(basename)"}
        }
    }
    

    Link: https://code.visualstudio.com/docs/languages/typescript#_hiding-derived-javascript-files

提交回复
热议问题