Pedro Costa
Pedro Costa

Reputation: 195

Excluding js.map files from project when .ts file is present

I have this in .vscode\settings.json:

"files.exclude": {
        "**/.git": true,
        "**/.DS_Store": true,
        "**/*.js": { "when": "$(basename).ts"},
        "**/*.js.map": { "when": "$(basename).ts"}
}

The .js line is working fine, but the last line with the .js.map pattern is not working even if left alone. Why is that?

Upvotes: 3

Views: 1187

Answers (3)

user2434369
user2434369

Reputation: 1

ver 1.4 File->Preferences->Workspace

settings.json

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

You don't need to see .map files anyway

Upvotes: 0

Steven Rudolf
Steven Rudolf

Reputation: 124

I use the following filter:

    "files.exclude": {
        "**/.git": true,
        "**/.DS_Store": true,
        "**/*.js": { "when": "$(basename).ts" },
        "**/*.js.map": { "when": "$(basename)" }
    }

This works because the transpilation result is an js-file and in addition an js.map-file. So the filter hides all map-files if a js-file is present and all js-files if a ts-file is there.

I like this one because my typescript transpiler runs in a background task and if there something goes wrong then the js.map-file pops up because of the missing corresponding js-file.

Upvotes: 7

Dauren Akilbekov
Dauren Akilbekov

Reputation: 5035

Try this:

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

Or if you want to hide all map files:

"**/*.map": {}

Upvotes: 1

Related Questions