Unreal build tool is used for generating compilerCommands_Project.json which is generated completely broken. This code fixes the error that is caused by not using quotes (so the cl.exe cannot found and parameters are passed completely wrong.)
This,
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX64\\x64\\cl.exe @\"C:\\ExampleProjectPath\\.vscode\\compileCommands_Project\\Project.210.rsp\""
Changed To This:
"\"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX64\\x64\\cl.exe\" @\"F:\\Edvar\\Projects\\Edvar\\ProjectRL\\.vscode\\compileCommands_ProjectRL\\ProjectRL.210.rsp\""
- Open Engine\Source\Programs\UnrealBuildTool\ProjectFiles\VisualStudioCode\VSCodeProjectFileGenerator.cs
- Navigate to line 822 (or just search for broken code.)
Change
Writer.WriteValue("command", String.Format("{0} @\"{1}\"", CompilerPath, ResponseFile.FullName));
to
Writer.WriteValue("command", String.Format("\"{0}\" @\"{1}\"", CompilerPath, ResponseFile.FullName));
in
Engine\Source\Programs\UnrealBuildTool\ProjectFiles\VisualStudioCode\VSCodeProjectFileGenerator.cs
Just add some quotes and fixed.