0

I have a repository in which there is a data/ folder that is also inside the .gitignore file to avoid pushing the data to GitHub. The folder has a lot of subfolders that are huge. Having this in my repo slows down VS Code's go-to-definition feature, track changes feature etc. Is there any way to prevent this from happening?

I tried including the folder under the watcher exclude in settings.json but that did not help.

starball
  • 20,030
  • 7
  • 43
  • 238
  • It does sound like `data` contains precious data. Do not mention it in `.gitignore`, because by doing so you entitle Git to delete it at any time it likes. If the goal is to not have `data` in the repository, just do not `git add data` and live with `git status` reporting `data` as `untracked files`. – j6t Feb 27 '23 at 06:58
  • @j6t "_Do not mention it in .gitignore, because by doing so you entitle Git to delete it at any time it likes_" ... what? ... no. Git will not remove untracked files unprompted. https://stackoverflow.com/q/61212/11107541 – starball Feb 28 '23 at 22:55
  • though git may remove local files that were once tracked if someone then commits a change that removes them from the git repo and you pull. https://stackoverflow.com/q/7098586/11107541 – starball Feb 28 '23 at 23:10
  • @user *Git will not remove untracked files unprompted* except that it will silently remove files that are mentioned in .gitignore if it thinks that they are in the way. Mind this trap! Don't mention precious files in .gitignore. – j6t Mar 01 '23 at 06:24
  • @j6t ah. I'm probably wrong then. I'm not a git expert. I've just never run into problems because I never have everything in my project repos is either tracked, or gitignored and can be regenerated if lost. I've never hand anything "in-between". Chalk it up to me lack of experience. – starball Mar 01 '23 at 06:35

1 Answers1

1

Use the files.exclude setting and add "data/": true to it. This will completely exclude the folder from VS Code's knowledge and features (unless an extension overrides your setting to do otherwise).

Other than that, I'm not sure what else you can do.

I suppose you could try to force the file associations for files in that folder to something that is interpreted more simply and doesn't get much intellisense by language extensions. You'd use the files.associations setting for that- something like "files.associations": { "/data/**/*": "plaintext" }. I've done that before in one of my own projects.

starball
  • 20,030
  • 7
  • 43
  • 238