LoginSignup
42
28

More than 5 years have passed since last update.

Visual Studio Code でファイル検索の除外設定

Last updated at Posted at 2016-07-01

Visual Studio CodeでRails開発をしていたら、検索(Ctrl/⌘+P)にSprocketsのキャッシュファイルがやたら出てくるので除外する方法を探した。

なんとか.excludeという設定はいくつかあるが、今回はsearch.excludeに設定すれば解決した。

  • files.exclude
    • ファイルブラウザに表示しない
    • 検索除外設定にも継承されるので、ここで指定したファイルは完全にないものとして扱われる
  • search.exclude
    • ファイルブラウザには表示するが、検索から除外する
    • 上記の通りfiles.excludeの設定を継承する
settings.json
  // ファイルブラウザに表示しない
  "files.exclude": {
    "**/.git": true,
    "**/.svn": true,
    "**/.DS_Store": true
  },

  // ファイルブラウザには表示するが、検索から除外する
  "search.exclude": {
    "**/node_modules": true,
    "**/bower_components": true,
    // 例えばキャッシュディレクトリを追加すると、検索で余計なファイルが出てこなくて便利
    "**/tmp/cache": true
  },

42
28
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
42
28