Skip to content

Instantly share code, notes, and snippets.

@boocs
Last active July 24, 2024 02:52
Show Gist options
  • Save boocs/f63a4878156295b6e854cac68672f305 to your computer and use it in GitHub Desktop.
Save boocs/f63a4878156295b6e854cac68672f305 to your computer and use it in GitHub Desktop.

VSCode/UE Intellisense Fixes Extension

Table of Contents


Unreal Engine

Compatible

  • 4.25
  • 4.26.1+
  • 5.0.0+

(newer Unreal Engine versions may require latest extension)

Incompatible

  • 4.26.0

General

This is the README for version 2.4.0 of the extension "UE Intellisense Fixes".

It currently supports Unreal Engine v4.25, v4.26.1+, and 5.0.0+

Feel free to comment about it here: https://gist.github.com/boocs/f63a4878156295b6e854cac68672f305#comments

Make sure to add @boocs to the comment to only notify me of the new comment.

You can comment about anything including any code quality comments. I'm just starting out in TypeScript and never really learned JavaScript so any info is great.

Code is hosted here: https://github.com/boocs/ue4-intellisense-fixes

Features

General

  • Fixes Unreal Engine/VSCode Intellisense config issues on startup.
    • It must happen at startup or the Tag Parser will add unneeded symbols to the browse cache file
  • Auto adds new files to compile commands file
  • Can force C++ standard in c_cpp_properties.json
  • Can force compiler path in c_cpp_properties.json (and compile commands file)
  • Added auto M1 Mac support (untested so let me know if it's working)

Logs

  • You can also see a log of what the extension is doing:

  • You can also get to the log by clicking on this icon. It will appear for 2 minutes after the extension is done.

Requirements

  • VSCode v1.63.1 or higher
  • Microsoft's C/C++ extension (ms-vscode.cpptools)
  • A VSCode project setup by the Unreal Engine (must set the engine to use VSCode)

Installation

  1. Download from here: https://github.com/boocs/ue4-intellisense-fixes/releases/

  2. Click the VSIX file to download (version will be different than pic)

    1. Click the Extensions button inside VSCode
    2. Click the ellipsis (3 dots) in upper-right corner of left side panel
    3. Choose "Install from VSIX..."
    4. Select the vsix file you just downloaded from GitHub

Running

The extension will fix your projects on startup of VSCode.

  1. You must first enable fixes in the settings. (see Extension Settings)

  2. After enabling fixes, restart VSCode for it to fix your project.

Tag Parser Cache

  1. After the fix has run and it's working, on your UE4 project, make sure to reset the Tag Parser cache to take advantage of the smaller cache size

  2. From the VSCode Command Palette, type reset and choose 'C/C++: Reset Intellisense Database'

  3. It'll take ~15 minutes for the Tag Parser to finish running

  4. You should only have to do this once. (Not after each extension update)

Multiple module projects or Plugins

When you add new source/header files or plugins and restart VSCode, to fix Intellisense for the new files, the extension will ask what response file you want to use for each new file.

If you don't want to mess with figuring it out, cancel the choice menu and reset your project which should fix it instead.

Extension Settings

  • Note: For v2.0.0+ search for settings using "ue intellisense" instead of ue4
  • Fixes are disabled by default. You must enable them.
  • You can only set these settings in the global User settings.
  • Restart VSCode for newly enabled fixes to take effect.

Here are the settings:

This extension contributes the following settings:

Versions 2.0.0+

  • UEIntellisenseFixes.enableFixes false
  • UEIntellisenseFixes.enableOptionalFixes false
  • UEIntellisenseFixes.cppStandard "" : Force C++ standard in c_cpp_properties.json
  • UEIntellisenseFixes.compiler.path "" : Force compiler path in c_cpp_properties.json UEIntellisenseFixes.compiler.strictPath false : Force compiler path in compile commands file

Known Issues

Note: If you've installed with a vsix file you can safely install new updates without uninstalling any previous version.

In very old versions there could be conflicts with fixes previously done.

  • Remove old unused settings

  • Remove any prior fixes and reset your project.

  • Delete old ue4-intellisense-fixes extension folder prior to copying new one over

Note: You can skip this step if you've never fixed your project's Intellisense.

To reset your project: Reset

Note: The wording may be different depending on your IDE

Example:

Note: You should only have to do this once per project.

Release Notes

https://github.com/boocs/ue4-intellisense-fixes/blob/master/CHANGELOG.md

Removing old unused settings

(Only for very old non-vsix installations)

Go to your global User settings file.

Easiest way to open this file:

  1. Go to your settings and click on User

  2. Scroll down till you see any setting with "Edit in settings.json" and click it.

  3. This will take you to the global user setting but will also automatically paste the random setting. Delete this newly created setting if you don't want it

  4. Now look in the file for old UE4Intellisense settings. Delete these.

Uninstalling

You can uninstall/disable the extension and then do a non-destructive reset of your project. Everything should be back to normal.

Comments

Comment using the gist feature below: (Must be signed in)

Use @boocs to notify only me that there's a new message

Help

Simple

For simple questions or comments use the gist comments below. Make sure to add @boocs to your comment so it only notifies me of a new comment.

Advanced

For advanced help post here:

https://github.com/boocs/ue4-intellisense-fixes/issues

Before posting make sure to do a non-destructive reset of your project.

Reset

This is a non-destructive reset

  • Close VSCode
  • Right click on project's *.uproject file (in project's parent directory)
  • Choose Generate Visual Studio project files... (Or something similiar)
  • Start VSCode so the extension fixes can take affect

To Top

@boocs
Copy link
Author

boocs commented Sep 5, 2022

@ZenithRahman

It should work with 4.27.2. I'm releasing a new version today with less complicated compiler path fixes. I would wait.

It also depends on what hardware you're running. I know M1 Mac can crash with 4.27.2 but are 'fine' with 5.0.3.

@boocs
Copy link
Author

boocs commented Sep 6, 2022

I released the new version 3.4.0. As always let me know of any bugs.

@abc6239657639
Copy link

abc6239657639 commented Sep 6, 2022 via email

@boocs
Copy link
Author

boocs commented Sep 6, 2022

@abc6239657639

Yep, I'm on Windows and tested it on 5.0.3. Should work!

I rented a cloud M1 Mac so that's why I know it works, on that hardware, for 5.0.3.

@Osama-Gamal
Copy link

I installed this extension but It didn't fix my project , I am using Garuda Linux (Arch Based Distro) , so after Installing the extension I added this settings

image

I closed visual code and opened it again but nothing happen , I just got this output which tells me that everything is fine

image

I tried also to disable optimize fix but still not work , so what can I do to make this extension works ?

@boocs
Copy link
Author

boocs commented Sep 18, 2022

@Osama-Gamal

For UE5 you need to change Cpp Standard to c++17 instead of c++14 you have it set to.

Restart VSCode after you change the setting.

@Osama-Gamal
Copy link

Osama-Gamal commented Sep 18, 2022 via email

@boocs
Copy link
Author

boocs commented Sep 18, 2022

@Osama-Gamal

I've tried it on Ubuntu 22.04 and it works. c++17 is the correct setting for UE5.

clang 13.0.1 is the recommended compiler for UE5 development: https://docs.unrealengine.com/5.0/en-US/linux-development-requirements-for-unreal-engine/
When you scroll up on my extension's log it'll tell you the compiler path that you're using.
Put that path in the terminal with a -v flag to see what version it is.

@Osama-Gamal
Copy link

Osama-Gamal commented Sep 19, 2022 via email

@boocs
Copy link
Author

boocs commented Sep 19, 2022

@Osama-Gamal
I have a new version of my extension 3.4.0. You can just install it and it will replace the old version.

The new extension version will help with only using one compiler. The weirdness I see is you have two different compiler paths set which might be the issue.

Go here to create a new issue after installing 3.4.0 and you still have errors:
https://github.com/boocs/ue4-intellisense-fixes/issues

@G433Dev
Copy link

G433Dev commented Nov 6, 2022

Hey, I'm using Unreal Engine 4.27. Errors are popping up in visual studio code Unable to resolve configuration with compilerPath "C:\Program". Using "cl.exe" instead. I have seen your extension, but will it support my version?

@boocs
Copy link
Author

boocs commented Nov 6, 2022

@G433Dev

Does it say it again if you restart VSCode? The extension should fix that error.

@YesIDont
Copy link

Will this plugin fix missing options for not included files? I mean when for example I used UStaticMesh in cpp file and would like to set the cursor on that name and hit ctrl + . to get quick fix that add missing include. So far after installing the plugin it didn't work.

@boocs
Copy link
Author

boocs commented Nov 30, 2022

@YesIDont

I don't think the Microsoft extension has that but I could be wrong.

@tgaldi
Copy link

tgaldi commented Mar 1, 2023

Is there a way to preserve changes to launch.json?

for example "requireExactSource": false

@boocs
Copy link
Author

boocs commented Mar 2, 2023

@tgaldi

Maybe save a copy and run a script to copy the backup over whenever it's changed. Launch.json rarely needs to be changed so is a viable option.

It's possible to make a relatively easy extension that does it. Here's how to get the launch.json through the api:
https://stackoverflow.com/questions/65520829/get-launch-configurations-from-vscode-extension

@tgaldi
Copy link

tgaldi commented Mar 2, 2023

@tgaldi

Maybe save a copy and run a script to copy the backup over whenever it's changed. Launch.json rarely needs to be changed so is a viable option.

It's possible to make a relatively easy extension that does it. Here's how to get the launch.json through the api: https://stackoverflow.com/questions/65520829/get-launch-configurations-from-vscode-extension

Thanks. Another options would be to have those settings generated with the launch file, though I haven't found documentation on how to set those options. Not sure if its something I could put in the Build/Target.cs or maybe command line options for the BuildTool?

EDIT:

Actually an easy way to do it is to add the following to the .uproject file:

	"PreBuildSteps":
	{
		"Win64": [
			"if exist $(ProjectDir)\\.vscode\\launch.json if not exist $(ProjectDir)\\.vscode\\launch_orig.json rename $(ProjectDir)\\.vscode\\launch.json launch_orig.json"
		]
	},
	"PostBuildSteps":
	{
		"Win64":[
			"if exist $(ProjectDir)\\.vscode\\launch_orig.json goto Overwrite",
			":Overwrite",
			"if exist $(ProjectDir)\\.vscode\\launch.json del /q /f $(ProjectDir)\\.vscode\\launch.json",
			"rename $(ProjectDir)\\.vscode\\launch_orig.json launch.json"
		]	
	}

Though it would be nice to just be able to specify these as build options. This is nice though bc I can now call the build tool with -ProjectFiles to regenerate the compileCommands along with calling build to update my source files.

@boocs
Copy link
Author

boocs commented Mar 2, 2023

@tgaldi

Cool, didn't know you could do that with uproject files! Will have to look more into them more.

@ffind
Copy link

ffind commented May 4, 2023

Hi @boocs installed by guide, I've chosen c++ 17, Xcode clang++. No intellisense

*.uproject file was found!

Extension "UE Intellisense Fixes" 3.7.2 is now active!

Found Unreal Engine v5.2.0

Fixing compiler paths in compile commands.
Below is the compile commands first entry command. (WARNING) If getting errors and the compiler path is unexpected reset your UE project.
command/arguments[0]: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
File write: /Users/**/.vscode/compileCommands_CryptRaider.json
Below is the compile commands first entry command. (WARNING) If getting errors and the compiler path is unexpected reset your UE project.
command/arguments[0]: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
File write: /Users/**/.vscode/compileCommands_Default.json
Done fixing compiler paths.

Fixing compiler path in c_cpp_properties.json.
End fix c_cpp_properties compiler path.

Fixing invalid paths in response files.
No invalid paths returned. No fixes needed.

** Warning **: Epic Games has included 199 paths that don't exist. Is this on purpose?
No invalid paths returned. No fixes needed.

** Warning **: Epic Games has included 199 paths that don't exist. Is this on purpose?
End fixing invalid paths in response files.

Fixing *.generated.h files!
Searching with fast-glob found nothing. (Sometimes isn't bug)
Correct *.generated.h files are found! Note: This extension doesn't test if all *.generated.h files have been created.
For Intellisense, you'll need to Build any newly created project files with the 'Editor' suffix config (e.g. MyProjectNameEditor (platform) Development Build).
All response files have the correct *.generated.h path!
End fixing *.generated.h

Fixing missing compile command files.
No missing file paths found. No fixes needed.
No missing file paths found. No fixes needed.
End fix missing compile commands.

Warning about Public/Private directory
Searching with fast-glob found nothing. (Sometimes isn't bug)
Searching with fast-glob found nothing. (Sometimes isn't bug)
You do not have this directory structure so no warning needed.
End warn Public/Private Directory

Attempting to fix UE workspace(Add empty tag parser).
UE's tag parser includes are set to empty array for performance.
The setting limitSymbolsToIncludedHeaders is already set to true.
End fix UE workspace(Add empty tag parser).

Attempting to fix wrong cppStandard.
Info : UE4 should be default c++14 (it can be c++17 with some special configuration)
Info : UE5 should be c++17
Current VSCode/cpptools cppStandard is:  (Can be blank)
Current c_cpp_properties.json's cppStandard is: c++17 (Overrides VSCode/cpptools if not undefined)
MAIN workspace c_cpp_properties.json's cppStandard is already set.
Current c_cpp_properties.json's cppStandard is: c++17 (Overrides VSCode/cpptools if not undefined)
MAIN workspace c_cpp_properties.json's cppStandard is already set.
Current VSCode/cpptools cppStandard is:  (Can be blank)
Current c_cpp_properties.json's cppStandard is: c++17 (Overrides VSCode/cpptools if not undefined)
UE workspace c_cpp_properties.json's cppStandard is already set.
Current c_cpp_properties.json's cppStandard is: c++17 (Overrides VSCode/cpptools if not undefined)
UE workspace c_cpp_properties.json's cppStandard is already set.
End fix wrong cppStandard.

Fixing launch.json.

Attempting to fix the json of launch.json...
Returning fixed launch file string.
No fixes need for malformed json!
Checking for deprecated external console...
There was nothing to fix!
End fix launch.json.

Start fix wrong intellisense mode
Cpu: Apple M1 Pro
This extension set MAIN workspace c_cpp_properties.json's intellisenseMode to macos-clang-arm64
This extension set MAIN workspace c_cpp_properties.json's intellisenseMode to macos-clang-arm64
This extension set UE workspace c_cpp_properties.json's intellisenseMode to macos-clang-arm64
This extension set UE workspace c_cpp_properties.json's intellisenseMode to macos-clang-arm64
End fix wrong intellisense mode.

Attempting to fix UE workspace optimization.

** Warning **: Optimization of UE is enabled!
Enabling UE optimization disables red squiggle compiling for the Unreal Engine source code.
This does not affect your project's source code (it still can have red squiggles).
You can disable this optimization in this extension's settings.
End fix UE optimization.

No need to write CryptRaider CCppProperties. It was unchanged.
No need to write UE5 CCppProperties. It was unchanged.

*** Number of error messages: 0
*** Number of warning messages: 3
If you get any errors you can try restarting VSCode to check if they've been fixed.

Extension is done.

@boocs
Copy link
Author

boocs commented May 4, 2023

@ffind

Since you're on Mac people have found you need to change your compiler path like so:

image

If you need more help make an issue here: https://github.com/boocs/ue4-intellisense-fixes/issues

@ffind
Copy link

ffind commented May 4, 2023

Hi @boocs thank you for quick response!
Before that I setup unreal engine tools and c++ extension from Microsoft. I had intellisese for class Super::... but had warning on header files, can't find them.

 "C_Cpp.intelliSenseEngine": "disabled",
 "clangd.path": "/usr/bin/clangd",

Then tried you solution with/usr/bin/clang++. And autocomplete for class is gone, just words from file.
Then I just tried to disable C++ and Unreal engine tools, and clangd, intellisense is gone.

Can you suggest which extensions should I use?

@ffind
Copy link

ffind commented May 4, 2023

@boocs wow I just enabled C++ extension and it started working! Thank you so much!

@boocs
Copy link
Author

boocs commented May 6, 2023

I've released my clangd extension for UE5

IMO clangd works better for code completion than Microsoft's C++ extension. It also has some other great features.

https://github.com/boocs/unreal-clangd

@JakobTischler
Copy link

Hi @boocs

I tried installing v3.7.2 in VSCode v1.81.1, getting the "Completed installing" info message. But, there's no call to reload VSCode, as is usual when installing .vsix files, nor does it show up in the extension list. Effectively, it doesn't seem to be installed at all.

Any ideas? Thanks.

@boocs
Copy link
Author

boocs commented Aug 30, 2023

@JakobTischler

That's one I have no idea on. I'll try to figure out some things to try.

@boocs
Copy link
Author

boocs commented Aug 31, 2023

@JakobTischler

Could it have to do with these settings? You can also choose 'Show Running Extensions' for info or even 'Enable All Extensions' to see if it fixes it.

image

@JakobTischler
Copy link

@boocs You were right that for some reason it was disabled by default. Don't know why or how, but alas... Thanks for the tip.

As a follow-up: I don't see UEIntellisenseFixes.enableFixes or UEIntellisenseFixes.enableOptionalFixes with 3.7.2. Have they been deprecated/removed?

@boocs
Copy link
Author

boocs commented Sep 1, 2023

@JakobTischler
They are only in global User settings so you can only set them in User.
image

image

@JakobTischler
Copy link

@boocs Sorry for the late reply. That would basically mean I can't use the extension if enabled only in a certain workspace or folder, correct? I wanted to restrict it that way in order to prevent overhead in other projects.

@boocs
Copy link
Author

boocs commented Sep 13, 2023

@JakobTischler
No, you can still do that. I disable extension globally and only enable it through workspace.

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