In VSCode I tend to create workspaces for projects. These generate <project-name>.code-workspace files, a bit like .Rproj files in RStudio.
I would tend to commit these files, but wanted to check with colleagues. They're not currently excluded by the template .gitignore.