Update UnrealEngine.gitignore
Unreal Engine supports project file generation for VSCode. Enhance Unreal ignore file for VSCode accordingly.
Reasons for making this change:
I'm an ordinary developer who is using Unreal Engine recently.
This PR makes sure that all files generated by Unreal Engine, which contains user/machine specific contents, is ignored by this ignore template out of the box.
.vscode folder will contain a bunch of compile commands, which consist of machine specific paths.
For example, in .vscode\compileCommands_<ProjectName>.json, there will be
{
"file": "C:\\Users\\<username>\\Unreal Projects\\PlayUnreal\\Source\\PlayUnreal\\PlayUnreal.cpp",
"arguments": [
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.38.33130\\bin\\Hostx64\\x64\\cl.exe",
"@C:\\Users\\<username>\\Unreal Projects\\PlayUnreal\\.vscode\\compileCommands_PlayUnreal\\PlayUnreal.1.rsp"
],
"directory": "C:\\Program Files\\Epic Games\\UE_5.4\\Engine\\Source"
}
Also, in <ProjectName>.code-workspace
{
"name": "Launch <ProjectName> (Shipping)",
"request": "launch",
"program": "C:\\Users\\<username>\\Unreal Projects\\<ProjectName>\\Binaries\\Win64\\UnrealGame-Win64-Shipping.exe",
"preLaunchTask": "<ProjectName> Win64 Shipping Build",
"args": [
],
"cwd": "C:\\Program Files\\Epic Games\\UE_5.4",
"stopAtEntry": false,
"console": "integratedTerminal",
"type": "cppvsdbg",
"visualizerFile": "C:\\Program Files\\Epic Games\\UE_5.4\\Engine\\Extras\\VisualStudioDebugging\\Unreal.natvis",
"sourceFileMap": {
"D:\\build\\++UE5\\Sync": "C:\\Program Files\\Epic Games\\UE_5.4"
}
}
If we create a new C++ project from latest version of Unreal Engine (5.4), .vscode is ignored
by the generated .gitignore file. (Although *.code-workspace is still not included.)
Links to documentation supporting these rule changes:
As a reference, the following is the generated default .gitignore file
when creating a new Unreal Engine project throught Unreal Engine Editor (Unreal Engine Editor for Windows v5.4).
Binaries
DerivedDataCache
Intermediate
Saved
.vscode
.vs
*.VC.db
*.opensdf
*.opendb
*.sdf
*.sln
*.suo
*.xcodeproj
*.xcworkspace
We get this quite a bit, but that is incorrect. The .vscode folder is the workspace folder and is intended to house workspace configuration/settings. We don't want to globally ignore this folder for that reason.
Please read more about the workspace folder here: https://code.visualstudio.com/docs/configure/settings#_workspace-settings
Could you please remove the entry for .vscode?
It's unfortunate that UE places generated contents in the .vscode folder,
while those contents are machine-specific.
Based on the design goal you mentioned, maybe we can reduce the impact by
explicitly listing the files and folders in .vscode that are generated by UE.
How do you think about this approach? :D
diff --git a/UnrealEngine.gitignore b/UnrealEngine.gitignore
index 6e0d95f..f6df498 100644
--- a/UnrealEngine.gitignore
+++ b/UnrealEngine.gitignore
@@ -1,6 +1,10 @@
# Visual Studio 2015 user specific files
.vs/
+# Generated machine-specific settings and commands
+.vscode/c_cpp_properties.json
+.vscode/compileCommands*
+
# Compiled Object files
*.slo
*.lo
@@ -34,6 +38,7 @@
# These project files can be generated by the engine
*.xcodeproj
*.xcworkspace
+*.code-workspace
*.sln
*.suo
*.opensdf
This PR is stale because there have been no updates in 90 days. It will close after 180 days of inactivity. Leave a comment if you want to keep it open :smile: