Skip to content

Instantly share code, notes, and snippets.

@yldrefruz
Created November 18, 2022 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yldrefruz/914e04b49b896473735f5c432b79bbf3 to your computer and use it in GitHub Desktop.
Save yldrefruz/914e04b49b896473735f5c432b79bbf3 to your computer and use it in GitHub Desktop.
Unreal Engine VSCode Intellisense Fix.

Why this error is happening:

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\""

How to fix:

  1. Open Engine\Source\Programs\UnrealBuildTool\ProjectFiles\VisualStudioCode\VSCodeProjectFileGenerator.cs
  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment