runtimeZero
runtimeZero

Reputation: 28046

Hiding .js and .map files in VS Code while

What kind of settings can I use in Visual Studio Code to hide certain .js and .map files ?

enter image description here

Upvotes: 4

Views: 5193

Answers (3)

Sangram Nandkhile
Sangram Nandkhile

Reputation: 18192

If you don't find settings.json in .vs code folder, you may generate it through vs code.

File >> Preferences >> Settings >>

Notice the drop-down on the right side. Click on it and select the workspace settings.

You may paste your json settings.

{
    "files.exclude": {
        "**/.git": true,
        "**/.DS_Store": true,
        "**/*.js.map": true,
        "**/*.js": {"when": "$(basename).ts"},
        "**/node_modules/": true, <-- To hide node modules files
        "**/*.spec.ts": true <-- To hide cli generated files
    }
}

Make sure that you save the file.

Upvotes: 2

Jess Chadwick
Jess Chadwick

Reputation: 2373

You probably don't want to blindly hide all .js and .map files, only the ones that are generated from an associated .ts file like you show in your screenshot.

To conditionally hide them, you're going to want to do this instead:

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

Upvotes: 18

toskv
toskv

Reputation: 31600

You can configure the files.exclude properties in the User Settings.

Add this to your user settings file.

{
  "files.exclude": {
    "**/.git": true,
    "**/.DS_Store": true,
    "**/*.js": true,
    "**/*.js.map": true
  }
}

You can open the settings file from the command pallet (ctrl + shift + p) and searching for settings.

Upvotes: 12

Related Questions