DEV Community

taku25
taku25

Posted on

This Week in UnrealDev.nvim: Major Cache Overhaul & Smarter Builds!

Hey, dev.to community!

Another week, another big update for the UnrealDev.nvim plugin suite. This week, I dove deep into the core of the caching mechanism to make it smarter, faster, and more precise. Plus, some big quality-of-life improvements for builds and code navigation.

Here’s what’s new!


🚀 Core Improvements

1. High-Precision Caching

This is the biggest change. Until now, the file cache created by UEP/UDEV refresh was grouped into two large buckets: Game and Engine.

I’ve refactored this to parse your build.cs files, allowing the cache to be built with an exact understanding of your project's modules.

2. Granular Scopes

Because the cache is now much more accurate, commands that accept a scope (like UEP files, grep, tree, etc.) can now use much more specific scopes:

  * Game: Your project's source code
  * Engine: The entire engine source code
  * Runtime: All Runtime-related source code (from both project and engine)
  * Editor: All Editor-related source code (including Runtime) (from both project and engine)
  * Full: All source code from the project and engine

3. Smarter Dependency Flags

The --deps-flag option also got a matching upgrade. We've moved from a simple --all-deps/--no-deps choice to a more nuanced system:

  * --shallow-deps (Default): Includes direct dependencies only.
  * --deep-deps: Includes all dependencies, recursively.
  * --no-deps: Includes no dependencies.

This is supported by all commands that use scopes and dependency flags.

4. Header Parsing Performance

I've moved header file parsing off the main thread and into a worker thread. This should make a noticeable difference and speed things up, especially on project refreshes.

5. Flexible Setup (Opt-out of Sub-module Init)

UnrealDev.nvim is a suite plugin that integrates multiple sub-plugins like UBT, UEP, and UCM.

This update adds a setup_modules option to the main UnrealDev.setup() function. This option allows you to control which sub-plugins are initialized by the main suite, giving you the flexibility to manage setup yourself.

For example, you can now prevent UnrealDev.nvim from setting up UBT.nvim, which allows you to configure UBT.nvim separately (e.g., in lazy.nvim) with its own specific opts.

Configuration Example:
Let's say you want to configure UBT.nvim individually, but let UnrealDev.nvim handle the rest.

-- 1. In your lazy.nvim (or other plugin manager) config: -- Set up UBT.nvim individually with its own 'opts' { 'taku25/UBT.nvim', cmd = { "UBT" }, dependencies = { { dir='~/Documents/git/UNL.nvim' }, }, opts = { -- UBT-specific logging, etc. logging = { level = "trace", echo = { level = "OFF" }, notify = { level = "OFF", prefix = "[UBT]" }, file = { enable = true, max_kb = 512, rotate = 3, filename = "ulg.log" }, perf = { enabled = false, patterns = { "^refresh" }, level = "trace" }, }, }, }, -- 2. Then, in your UnrealDev.nvim setup: -- Tell the suite *not* to set up UBT. { 'taku25/UnrealDev.nvim', opts = { setup_modules = { UBT = false, -- UBT.nvim will be set up individually -- UEP, ULG, UCM, etc. are true (default) and can be omitted } }, } 
Enter fullscreen mode Exit fullscreen mode

Any modules you don't specify in setup_modules will default to true (meaning UnrealDev.nvim will set them up as usual). Existing users do not need to change their configuration; everything will work just as it did before.


✨ New Commands

1.  UEP/UDEV enums

      * You can now get a full list of enums in your project and jump straight to their definition! This is possible thanks to a new enum-parsing pass.
      * This also means UEP/UDEV goto_definition now works for enums.
      * (Note: This doesn't currently work for typedef-based types like FVector3D.)

2.  UEP/UDEV config_files

      * Quickly list and open any of your project's config (.ini) files.

3.  UEP/UDEV config_grep

      * Lets you run grep scoped specifically to your config files.


🛠️ Changes to Existing Features

1.  UEP/UDEV tree

      * Thanks to the more accurate file data, the default scope for this command has been changed to runtime.

2.  UCM move / UDEV move_class / UCM rename / UDEV rename_class

      * These class refactoring commands are now much smarter. When you move or rename a class, the plugin will automatically update the corresponding .cpp file's header include path AND its "xxxx.generated.h" include.


🔗 Tighter UBT Integration

Commands that require a build target (like UBT/UDEV build!) have been improved. If UEP is loaded and your project has been analyzed, the plugin will now parse your Target.cs files to provide a perfectly accurate list of build targets.

I've also added two new settings to your UBT config:

1.  Specify your installed SDKs
    If you have platform SDKs like iOS or Android installed, you can tell UBT to offer them as build targets:

    lua     -- UBT config     {       has_sdks = { "iOS", "Android" },     }    

2.  Use last preset as default
    This new option (defaulting to true) will make UBT remember the last build preset you chose for each project. This means you can just run UBT build! without setting a preset, and it will automatically suggest your last-used one.

    lua     -- UBT config     {       use_last_preset_as_default = true, -- default: true     }    

    (Note: This setting is not persisted forever. It resets when you close Neovim.)


📝 The Wiki is Live!

I've officially started a GitHub Wiki for the UnrealDev.nvim repository!

Check it out here: https://github.com/taku25/UnrealDev.nvim/wiki

There isn't a ton of info there yet, but I'll be adding more and more content over time.


📅 What's Next?

Now that I've optimized the second (heavy) half of the UEP refresh process, I really want to speed up the first (project analysis) half. I'm struggling with it a bit, but I plan to keep fighting with that optimization next.

Oh, and I previously mentioned I might try to automate forward-declarations. I've decided to drop that feature. I remembered that since C++11, you can just re-declare the enum type at the definition site, which makes a complex automation feature less necessary.


💬 A Quick Personal Note

I've been watching the "Unique clones" metric on the GitHub repo, and it makes me really happy to see a few new clones every single day.

Knowing that people are actually using this stuff is a huge motivation for me as a developer. Of course, there are also days with zero clones, which reminds me that it's still a very niche tool. But it's also cool to realize, "Wow, there are actually other people out there using Neovim for Unreal Engine!"

Thanks for reading, and see you in the next update!

Top comments (0)