WARNING
: Extension version 3.0.0+
has breaking changes. To upgrade version 2.0.0+
projects see section:
note
: Ubuntu users: I started getting this error message wtih 5.6.0 but it still seemed to work.
- Unable to watch for file changes. Please follow the instructions link to resolve this issue.
- See here
- Updates
- Important info
- Info
- Requirements
- Recommended Extensions
- Quick Start Guide
- More Documentation
- Upgrading Older Projects
- Mac Support
- Troubleshooting
- Create Full Source Unreal Engine projects
- Older Unreal versions with newer C++ libraries (Windows only)
- Create BuildConfiguration.xml
- Installing correct LLVM (clangd/clang) versions
- Installing correct library versions (Windows)
- All supported Unreal version requirement links
- Downloading Source Code
-
Big code organization, new yeoman extension skeleton, strict eslint
-
Adds toggle button bottom right(UC) for code completion modes
UC⚡
(fast) = Non-macro completions and the most popular macro completionsUC⌚
(slow) = Non-macro completions and almost all macro completions
-
Removed extension's completion file, completionHelper.cpp, loading at startup
-
command:
Set custom system includes
(Windows only)- Allows you to set Windows SDK and C++ library versions that clang uses
- Also autoruns command when creating extension project
- On VSCode start, detects and shows warning if not set
- Setting: "unreal-clangd.systemIncludes.showMissingWarning" to false to remove warning
-
command:
Show Project Info
-
command:
Open 'Add Completions' Files
- Allows you to customize code completions that aren't added by default
- addCompletions.h
- Can add headers to add non-macro completion
- Doesn't affect code completion file loading speed
- addMacroCompletions.h
- Can add headers to add non-macro and macro completions
- Will affect code completion file loading speed
-
Warns, on startup, when project was not refreshed correctly
-
Note
: Unreal source file support status is changed to partial- Looking at future updates for better support (hopefully)
-
See
Changelog
for more info:
-
This extension now uses UBT(Unreal Build Tool) to
Refresh your project
to update Intellisense files(compile commands). So this runs when you run the'Update Compile Commands'
command. Since this refreshes your project, your project's *.code-workspace file will be refreshed removing your clangd settings and others! but... -
This extension will
automatically backup and restore
your clangd settings when you run theUpdate Compile Commands
command. -
Make sure not to use any other way to
Refresh
your project.
Note:
I've added a setting that allows you to add additional settings to be backed up.
See change log for more info: https://github.com/boocs/unreal-clangd/blob/v3/CHANGELOG.md#250-2024-05-05
This extension:
-
Provides fast Code Completion, Formatting, and other cool features!
-
Has a command to create a clangd project for you
-
Fixes some clangd/Unreal quirks
-
Has a uninstall command
Note:
Windows users can use clang/clangd for Intellisense and still build with Microsoft's compiler
- Unreal v5.2+
- LLVM (clang/clangd) Different Unreal versions requirement different LLVM versions (see below)
- Unreal project created for VSCode
- VSCode clangd extension (Do not let the VSCode
clangd
extension auto install LLVM) - Microsoft C++ extension for its
Building/Debugging
Capability
- Before explanation on getting requirements here are some useful links:
note
: The links below will tell you the requirements for Unreal 5.6.#
- If you need requirements for older Unreal versions see All supported Unreal version requirements links
-
Unreal 5.6 Release Notes (Platform SDK Upgrades)
- Note: The link above can take too long to load so might not take you to the right section (
Platform SDK Upgrades
) - Try loading link twice
Windows
: Best resource (has everything you need)- Shows different .NET versions needed
- Shows
LLVM
(clang/clangd) version needed - Shows Windows SDK version needed
- Shows The C++ library needed
- Note: I would recommend using the versions mentioned in the section
IDE Version the Build farm compiles against
- See: Installing correct library versions (Windows)
- Also shows useful
Linux/Mac
info
- Note: The link above can take too long to load so might not take you to the right section (
-
Unreal Docs: Hardware and Software Specifications
- Useful info for
Linux
andMac
(Not that useful for Windows) - Use
Operating System
dropdown to change to Linux/Mac - You can change
Unreal Engine version
on left hand side
- Useful info for
-
Unreal Docs: Linux Development Requirements
- Shows useful
Linux
info - You can change
Unreal Engine version
on left hand side
- Shows useful
-
Unreal Docs: MacOS Development Requirements
- Shows usefull
Mac
info - You can change
Unreal Engine version
on left hand side
- Shows usefull
-
Microsoft's C++
Needed for Building/Debugging
-
File Switcher
For Alt+O clangd keyboard shortcut (Head/Source switcher)
Using Clangd's Alt+O implementation is buggy, for Unreal Source files, so this extension is a good alternative -
C++ Create Definition (my extension)
Updated Sept 2023
-
[Unreal Reflection Function Parameters] (Deprecated) New project coming soonish
This is generally correct, when using non-full source, but your situation could be different.
- Read the Requirements section
- Different Unreal Engine versions require different LLVM versions(Unreal 5.6 requires LLVM 18.1.0(Linux) and LLVM 18.1.8(Windows))
-
Install the vsix file from this github
(The vsix file can be downloaded from the
Releases
section on the right side column of this page. You might have to scroll up to see it.)
- Click the extensions icon
- Click the ellipsis (3 dots)
- Choose Install from VSIX...
- Ignore any VSCode warning messages (should go away after creating a project)
Linux:
In the next step(project creation), File Dialogues might spawn behind VSCode(known Ubuntu bug)
-
Run extension command "Create Unreal clangd project" on your Unreal project
Ubuntu
: It'll ask you to locate clangd. I find it in /lib/llvm-18/bin (for Unreal 5.6.#)
- Use the
Editor
suffix andDevelopment
config when Building/Running or light debugging
- clangd will index your existing project
- Large projects like Lyra will take ~7 minutes
- You can still use code completion
- If on
fast mode
and a file takes 5 seconds to load code completion fully it will take ~10 seconds while indexing - This only happens once*
- Any individual file you add will also be indexed but that won't take very long
-
Try building your project
- Can fix fake red squiggles
-
Or try restarting VSCode
- Version 3.0.0 can detect stuff on startup
-
Or try running extension command
Update compile commands file (refresh project)
- Run after adding source files to your project
- Extension should alert you automatically. If this isn't run, after adding new files, then errors will occur
- Run after adding source files to your project
-
Other red squiggle errors will be because, with Unreal projects, IWYU is enabled by default.
- To fix, #include the header to the class or to whatever symbol the red squiggle is complaining about
This README has pretty good documentation but if you want to see extended documentation then click below.
Extension 3.0.0 has breaking
changes. To upgrade version 2 projects:
-
Run the extension's command:
Uninstall Unreal Clangd Project
on your project. -
In your Unreal directory:
- delete file:
.clangd
- delete file:
.vscode/unreal-clangd/comple_commands.json
- delete file:
-
With extension version 3.0.0+: Run the extension's command:
Create Unreal clangd project (cfg files and settings)
This hasn't been proven to work yet(let me know!)
.
There a new setting to try if you haven't been successful in getting clangd to work.
unreal-clangd.creation.MacFileLanguage
You can change the clangd Mac file language to C++ or Objective C++ (thanks to user szabot0412)
- The Objective C++ setting,
-xobjective-c++
, is a misnomer. It just means it will treat Objective C++ files as Objective C++ and C++ files as C++ - This setting is set in your .clangd files during project creation (.clangd file in project directory and Unreal directory)
- in the Add: section, it's the line that shows
- -xc++
or- -xobjective-c++
so if you want to test quickly with reinstalling. I believe- -xobjective-c++
is the correct one to use but I could be wrong!
The command Show Project Info
was added in extension version 3. This command will show Unreal, clangd, build compiler, and clangd compiler versions.
Adding code or a space, in a header file, anywhere above the GENERATED_BODY macro, or other similiar Macros, will cause red squiggles. This is because the GENERATED_BODY macro uses the __LINE__ preprocessor macro.
- You'll need to Build your project to get rid of the red squiggles.
After building, extension v3.0.0+ now restarts the clangd language server automatically. If you need for clangd to reevaluate a file manually then you can try the things below.
- You can type a space in the file, wait half a second, and delete the space (this makes clangd reevaluate the file)
- You can also run the command clangd:
Restart language server
(on restart clangd will reevaluate the file) - Or you can close and reopen the file
The extension pulls the Unreal Uri from your project's *.code-workspace file. If you don't create a Unreal (VSCode) project then this file isn't created. You also must double click this file to open your project as a 'Workspace'. You can force Unreal to always create a VSCode project with a BuildConfiguration.xml file.
-
*.code-workspace file
-
When you double click on the file you'll see 'Workspace' in the VSCode title area:
-
When you open VSCode without a project, you'll get this screen which also tells you if you're opening as a 'Workspace'
I've run into this bug. On Windows, pressing control+space or control+shift+space will manually activate Code Completion. Look up your keyboard shortcut for your system.
If you enable a plugin or add a module to *.build.cs you'll need to run the extension command: Update compile commands file (refresh project)
.
- This should add folders to system includes
- It probably won't add plugin/module symbols to code completion
- You can add headers to code completion by using the extensions addCompletions.h or addMacroCompletions.h
- Use extension command:
Open 'Add Completions' files (regular or macro)
See this section for more info
- See this section on how to install different Windows SDK or C++ library version
- Run extension command:
Set custom system includes (Windows only)
- This command lets you choose the versions that clang uses
- This can happen with the macro of
FORCEINLINE
- There could be others
- Lyra doesn't seem to use IWYU(include what you use) for this macro and doesn't include any header for this macro
- Double click on the UE5.code-workspace file in your Unreal directory
- Build the Editor inside VSCode
- Since you want to Launch it after it's done you can just use Run And Debug instead of Run Build Task. Unless you're heavily debugging you'll want to use the Development config.
- Once you set the above you can run it by hitting the F5 key or ctrl+F5 to run it without debugging.
- After it builds the Editor should run and you can now create a Full Source project.
- This is what pops up after I'm done compiling and it runs: (This is full source 5.4.1)
Extension version 3 allows Windows users to choose their library versions so this section no longer applies.
- See this section on how to install different Windows SDK or C++ library version
- Run extension command:
Set custom system includes (Windows only)
To make Unreal Build Tool create a VSCode project by default you can use a BuildConfiguration.xml file. Here is the info about which directories you can create it in and what options are available.
note
: BuildConfiguration.xml in Project directory either doesn't work or is buggy. I personally wouldn't put it there.
https://dev.epicgames.com/documentation/en-us/unreal-engine/build-configuration-for-unreal-engine
Note:
On Windows I created the directory structure and xml file in my Documents folder (ME is my user name so it will be different for you):
E:\Users\ME\Documents\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml
Here's a basic BuildConfiguration.xml (It's easy to create all this using VSCode)
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<ProjectFileGenerator>
<Format>VisualStudioCode</Format>
</ProjectFileGenerator>
</Configuration>
note
: These examples are for Unreal 5.6.#
. Make sure you get the correct library and compiler versions for your specific
Unreal version
- Get the correct LLVM (clangd/clang) version from the Release Notes of your Unreal version.
- See: All supported Unreal version requirements links for
Release Note
links
- See: All supported Unreal version requirements links for
- If you check out the Release Notes link for 5.6.# you see that
Windows uses LLVM 18.1.8
- You can download it here: https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.8
- The file you want is:
LLVM-18.1.8-win64.exe
- Any of the links in All supported Unreal version requirements links will tell you which version of
LLVM
(clangd/clang) to install - It's hard on Linux to install specific versions unless you want to compile it yourself
- You can try the latest of the version it recommends but might run into issues
- If you do run into issues try compiling/using the correct version
- Here's how I've had success installing version 18 for Unreal 5.6.#
- Make sure you don't have an existing llvm.sh file already in the directory you have open. The file you download won't overwrite the file already in you directory. It will name it something else.
Note
: This installs 18.1.8 but18.1.0
is the recommendation for Linux and Unreal 5.6.#
wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 18
- With Ubuntu, and Unreal 5.6.0, I find
clangd
in/lib/llvm-18/bin
dotnet-runtime-6.0
anddotnet-sdk-6.0
might also be required but doesn't say in any of the requirement links.- This was true in Unreal ~5.2.
- Maybe newer versions are required now.
- dotnet 8 is used for 5.5 and 5.6
- This may only be true if you use the Microsoft C# extension
- Unreal docs doesn't give specifics about clang/clangd like it does Windows/Linux
- It gives
Xcode
versions, which you should install for its libraries.- I recommend the
Xcode
version listed in the Unreal Release Notes for your Unreal version - Section:Platform SDK Upgrades
Subsection:IDE version the Build farm compiles against
- See All supported Unreal version requirements links for link to Release Notes
- I recommend the
- For what
LLVM
(clang/clangd) version to install I would try following the Linux instructions- Extension version 3 has a
Show Project Info
command that will do what's below - or you can...
- Go to your project's .vscode folder
- Open up one of the compile commands JSON files that are in there.
- Check which compiler it's using.
- Open the compiler's parent folder in your terminal and poll it for version info
- Install the LLVM version which matches the compiler you just polled
- Extension version 3 has a
Note
: In the 3.0.0 extension release, you can choose the C++ library and Windows SDK the project uses. This can minimize problems.
-
Run the
Visual Studio Installer
to install other versions of:- C++ Libraries
- Windows SDK
- .NET libraries
-
I use the stand-alone
Visual Studio Build Tools 2022
but this also should work if you have theVisual Studio 2022
IDE installed. -
This example is for Unreal 5.6.# but it can apply to older Unreal versions. Older versions will probably require different clangd/library versions so make sure to see here for older version requirement links: Older Version Requirement Links
-
From the
Visual Studio installer
click onModify
next to Build Tools 2022 or VS 2022 IDE -
Switch the tab to
Individual components
(To make it easier use Search Components box) -
Windows users will most likely find all requirements in the Unreal Release Notes (
Platform SDK Upgrades section
): 5.6 Release Notes (pic of release notes instep 7
)Note:
The 'release notes' link is slow to load so might not take you to the correct 'Platform SDK Upgrades' section unless you load twice.- Use C++/Windows SDK versions found in the subsection
IDE Versions the Build farm compiles against
. Found under the Platform SDK Upgrades section.
Below are the versions found in the Unreal 5.6 Release Notes and what they look like in the Visual Studio Installer (Individual components)
.
-
Here's the
Platform SDK Upgrades
section in the Unreal 5.6 Release Notes- For older Unreal version Release Notes see here
-
Selecting what to install in the
Visual Studio Installer
-
Visual Studio 2022 17.8 14.38.33130
(In subsection: 'IDE Version the Build farm compiles against' in 5.6 release notes)
Visual Studio Installer :
- Some other entries look similiar.
- Note the
x64/x86 build tools
-
Windows 10 SDK (10.0.22621.0)
(In subsection: 'IDE Version the Build farm compiles against' in 5.6 release notes)
Visual Studio Installer :
Windows 11
: Uses same version number unless specified
-
.NET 8.0
(Found in Unreal 5.6 Release Notes. Platform SDK Upgrades section):
Visual Studio Installer :
-
.NET 4.6.2 Targeting Pack
(Found in Unreal 5.6 Release Notes. Platform SDK Upgrades section):
Visual Studio Installer :
-
-
Make sure to click the Visual Studio Installer's
Modify
button to install your new libraries.
-
Release Notes link is slow to load
- Load site twice to go directly to section:
Platform SDK Upgrades
If that doesn't work
search for 'm SDK' to take you to the correct section
- Load site twice to go directly to section:
-
Release Notes are best for
Windows
but has useful Linux/Mac info- Info in Platform SDK Upgrades section
- For Windows:
- Use C++/Windows SDK versions found in subsection 'IDE Version the Build farm compiles against'
-
Also see:
Release Notes: 5.6.# (Platform SDK Upgrades)
Here's what the Windows requirements look like(section: Platform SDK Upgrades):
Unreal Docs Requirements: Requirements
Unreal Docs Linux Requirements Linux
Unreal Docs MacOS requirements MacOS
Release Notes: 5.5.# (Platform SDK Upgrades)
Here's what the Windows requirements look like (section: Platform SDK Upgrades):
Unreal Docs Requirements: Requirements
Unreal Docs Linux Requirements Linux
Unreal Docs MacOS requirements MacOS
Release Note: 5.4.# (Platform SDK Upgrades)
Unreal Docs Requirements: Requirements
Unreal Docs Linux Requirements: Linux
Unreal Docs MacOS Requirements: MacOS
Release Note: 5.3.# (Platform SDK Upgrades)
Unreal Docs Requirements: Requirements
Unreal Docs Linux Requirements: Linux
Unreal Docs MacOS Requirements: MacOS
Release Note: 5.2.# (Platform SDK Upgrades)
Unreal Docs Requirements: Requirements
Unreal Docs Linux Requirements: Linux
Unreal Docs MacOS Requirements: MacOS
If you don't want to install the vsix located on github you can compile it yourself and then use vsce package
to create the vsix file.
When downloading source code you won't be able to compile until you run:
npm install
on the source code parent directory.