新建会话
Ctrl
K
  • 网站
  • 文档
  • PPT
  • 表格
  • 深度研究
Kimi Code Kimi Claw
历史会话
  • 查看手机应用
  • 关于我们
    • 探索月之暗面
    • 开放平台
    • 社会招聘
    • 校园招聘
    • 用户协议
    • 隐私协议
  • Language
  • 用户反馈

VS Code: Exclude Files Except .prg

After the seminar on using VS Code with Github and CoPilot, I decided to give it a try for editing. I have used UE Studio for many years, and find it does what I want except for AI integration. So I decided to work with VS Code, knowing others are using it also. Here is my main question. Right now I have all of the source code in a single folder. This includes .prg files, .bmp, .ico, .c, and .obj plus my .mak and of course my .exe that is created. When I set up Explorer, all of the files show up. I only want it to show the .prg files. I tried putting the other files in other directories but then when performing the build, it reports it can't find the .ico files. That is annoying because they are there and the path is valid. I have not been able to set a filter to just show files I want ( like just the .prg files ). As anyone had success setting this up ?
搜索
VS Code Settings File Filtering Shows Only. prg Files
26 个结果
Yes—VS Code can hide every file except the ones you really care about.
The trick is to tell the Explorer what to exclude, rather than what to show, and you do that in the workspace-scoped settings.json.

Step-by-step

  1. Open the folder that contains your project in VS Code.
  2. Press Ctrl + Shift + P (or Cmd + Shift + P on macOS) and run
    Preferences: Open Workspace Settings (JSON).
    This creates / opens .vscode/settings.json in your project root.
  3. Add the following entry:
    jsonc
    复制
    "files.exclude": {
        "**/*": true,           // hide everything …
        "**/*.prg": false       // … except .prg files
    }
    You can list as many exceptions as you need (for example, also allow the .mak file):
    jsonc
    复制
    "files.exclude": {
        "**/*": true,
        "**/*.prg": false,
        "**/*.mak": false
    }
  4. Save the file.
    The Explorer immediately refreshes and only the .prg (and any other whitelisted) files remain visible .
🔎 The filter does not move or delete anything on disk, so your build scripts will still find the .ico, .obj, etc