Skip to content

AlexMervin/ue-clangd-helper

 
 

Repository files navigation

UE Clangd Helper

A minimalistic tool to make Clangd VSCode extension work smoothly with Unreal Engine projects. The extension:

  • Automatically generates Clang compile commands file using UBT and copies it in the project directory.
  • Updates generated header files using UBT on demand to prevent Clangd static analysis errors.
  • Generates .clangd and .clang-format files to optimize code formatting and static analysis for Unreal Engine projects.

Quickstart

  1. Identify Clang Version: Visit the Unreal Engine Release Notes for your specific version. Search for the "IDE Version the Build farm compiles against" section to find the LLVM Clang version suggested by Epic. If you have multiple engine versions installed, use the LLVM Clang version corresponding to the latest UE version on your machine. Then download and install it from https://github.com/llvm/llvm-project/releases
  2. Install Clangd: Install the official clangd extension for VS Code.
  3. Install This Extension: Download and install this extension (.vsix).
  4. Unreal Editor Configuration:
    • In Unreal Editor, go to Editor Settings > General > Source Code.
    • Set Source Code Editor to Visual Studio Code.
    • Select File > Generate Visual Studio Code Project.
  5. Initialize: Open the generated .code-workspace project in VS Code and run the command: UE Clangd: Setup Project.

Usage

1. Structural Changes

If you add, remove, or rename source files:

  • Run UE Clangd: Refresh File Changes (New/Move/Rename).
  • This triggers the generation of a new compile database and copies it to the project root.

2. Header Iteration

If you modify a header file (especially above the class declaration) and see false red squiggles:

  • Run UE Clangd: Refresh Header Changes (Fix False Errors).
  • This executes UHT to sync generated headers and restarts the clangd server to pick up the changes.

Extension Settings

  • ueClangdHelper.generateConfigs: (Default: true) Generates .clangd and .clang-format files in the project root.
  • ueClangdHelper.syncCompileCommands: (Default: true) Automatically mirrors the engine-generated JSON to the project directory.

Requirements

  • Unreal Engine 5.X: Tested on UE 5.5+.
  • VS Code Workspace: The project must be opened via the .code-workspace file generated by Unreal to correctly resolve Engine and Project paths.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 94.7%
  • JavaScript 5.3%