Skip to content

Instantly share code, notes, and snippets.

@chillpert
Last active February 26, 2024 13:34
Show Gist options
  • Star 37 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save chillpert/1a76ae8e9cfafb36d3bf9e343d32fedc to your computer and use it in GitHub Desktop.
Save chillpert/1a76ae8e9cfafb36d3bf9e343d32fedc to your computer and use it in GitHub Desktop.
Debugging and autocompletion for Unreal Engine 4 and 5 projects in (Neo)vim

Debugging and autocompletion for Unreal Engine 4 and 5 projects in (Neo)Vim

+++ Updated for UE 5.1 (see bottom)

Autocompletion

For autocompletion there are two options:

  1. coc (Vim, Neovim)
  2. LSP (Neovim only)

In my experience, coc is easier to set up. If you want to get started as quickly as possible, this is your best bet.

Coc

  1. Install coc.vim, e.g. with vim-plug inside .vimrc: Plug 'neoclide/coc.nvim'
  2. Run :CocInstall coc-clangd

You will likely have to familiarize yourself with coc's shortcuts first or customize it as you see fit.

LSP

Setting up LSP takes a bit of time but for those that already have it up and running, there is probably not much to do. To keep this short, I will not explain the setup process. However, feel free to copy my Neovim config from my dotfiles. I have also set up some extra features for clangd in my config, if you are interested. If you wish to start from sratch, check out the server configuration for clangd and the completion plugin nvim-cmp as a starting point.

Creating the compile database

No matter which option you pick, you must do the following steps first:

  1. In UE
    • go to Edit - Editor Preferences - General - Source Code - Source Code Editor and select Visual Studio Code
    • go to File - Refresh Visual Studio Code Project for UE4 or Tools - Refresh Visual Studio Code Project for UE5
  2. Create a symlink from your project's root directory to myProject/.vscode/compileCommands_myProject.json ln -s .vscode/compileCommands_myProject.json compile_commands.json

If you open your project in (Neo)vim and you are greeted by tons of error messages after you have successfully set up either coc or lsp, you might have to modify your compile_commands.json. For this purpose, I have created a file called clang-flags.txt that contains a bunch of compile flags which improve the experience drastically. The files look like this:

-std=c++20
-ferror-limit=0
-Wall
-Wextra
-Wpedantic
-Wshadow-all
-Wno-unused-parameter

Yes, C++20 is not even supported by UE, yet this got rid of many false error messages.

Now you need to modify your compile_commands.json to use clang-flags.txt. Using (Neo)vim to modify the file is easy but making a little script to automate this process is probably worth it in the long run. Add @/path/to/my/clang-flags.txt after clang++.

{
	"file": "/home/User/MyGame/Plugins/UEGitPlugin/Source/GitSourceControl/Private/GitSourceControlMenu.cpp",
	"command": "clang++ @/path/to/my/clang-flags.txt /home/User/MyGame/Plugins/UEGitPlugin/Source/GitSourceControl/Private/GitSourceControlMenu.cpp @/home/User/MyGame/.vscode/compileCommands_MyGame/GitSourceControl.4.rsp",
	"directory": "/home/User/unrealengine/Engine/Source"
},

Make sure that all command entries also contain the respective file that is supposed to be compiled. Above we are trying to compile GitSourceControlMenu.cpp, so its path should be added after clang-flags.txt and before the rsp file. This procedure has to be done for all .h and .cpp files. I highly recommend any type of automation for this process via some simple scripts. At least under UE5, I don't need to do this manually anymore. I regenerate this file regularly using ue4-cli's ue4 gen command.

Another option to eliminate false error messages is using your own clang instead of the one that UE ships with by default. Clang 14 is working well for me. All you need to do is to remove the path before clang++ as shown in the code snippet above. To check if everything is working, simply run the command entry of some arbitrary file in your terminal. You might still get some errors but for the most part you should see a relatively lengthy compilation process. This is also equivalent to the time it will take until you get any completion results inside of (Neo)vim.

Feel free to use this little code snippet to fix-up your compile database (it requires ue4-cli, more about it down below):

#!/usr/bin/env bash

ue_path=$(ue4 root | tail -1)
target="clang++ @'$(pwd)/clang-flags.txt'"

sed -i -e "s,$ue_path\(.*\)clang++,$target,g" compile_commands.json

However, this code won't add headers and source files to your compile database in case they are missing.

Debugging

  1. Install vimspector, e.g. Plug 'puremourning/vimspector'
  2. Configure debugging vimspector keybinds or simply add let g:vimspector_enable_mappings = 'HUMAN' to your .vimrc.
  3. Create a .vimspector.json inside of your project's root directory (simply refer to the myProjectEditor (DebugGame) entry in myProject/.vscode/launch.json), e.g.
{
  "configurations": {
    "Launch": {
      "adapter": "vscode-cpptools",
      "configuration": {
        "request": "launch",
        "program": "/path/to/UnrealEngine/Engine/Binaries/Linux/UE4Editor-Linux-DebugGame",
        "args": [ "/path/to/myProject/myProject.uproject" ],
        "cwd": "/path/to/UnrealEngine",
        "externalConsole": true,
        "MIDebuggerPath": "/usr/bin/gdb",
        "MIMode": "gdb"
      }
    }
  }
}
  1. Compile a debug build path/to/UnrealEngine/Engine/Build/BatchFiles/Linux/Build.sh myProject Linux DebugGame '/path/to/myProject/myProject.uproject' -waitmutex
  2. Set a breakpoint (F9) and start debugging (F5) in Vim and your project will open in a new instance for debugging.

If you just wish to compile your project refer to the following entries in myProject/.vscode/tasks.json: path/to/UnrealEngine/Engine/Build/BatchFiles/Linux/Build.sh myProject Linux Development '/path/to/myProject/myProject.uproject' -waitmutex For anything else building and debugging-related simply refer to tasks.json and launch.json in myProject/.vscode.

I am currently trying to set up nvim-dap for Neovim. As soon as it's working, I will add the instructions here.

ue4-cli

I highly recommend using ue4-cli. This application is primarily used for compiling your project from the terminal but it can do a bunch of other neat things like running automation tests, generating IDE project files, cleaning your build files, and even packaging your build. It also works for UE5 if you set the engine path manually (at the time of writing, this is still a bug). I have also defined a function in my .zshrc to act as a wrapper for ue4-cli. Feel free to use this for some more inspiration.

# Expand ue4cli
ue() {
	ue4cli=$HOME/.local/bin/ue4
	engine_path=$($ue4cli root)

    	# cd to ue location
	if [[ "$1" == "engine" ]]; then
		cd $engine_path
   	# combine clean and build in one command
	elif [[ "$1" == "rebuild" ]]; then
		$ue4cli clean
		$ue4cli build 
		if [[ "$2" == "run" ]]; then
			$ue4cli run
		fi
    	# build and optionally run while respecting build flags
	elif [[ "$1" == "build" ]]; then
		if [[ "${@: -1}" == "run" ]]; then
			length="$(($# - 2))" # Get length without last param because of 'run'
			$ue4cli build ${@:2:$length}
			$ue4cli run
		else
			shift 1
			$ue4cli build "$@"
		fi
    	# Run project files generation, create a symlink for the compile database and fix-up the compile database
	elif [[ "$1" == "gen" ]]; then
		$ue4cli gen
		project=${PWD##*/}
		ln -s ".vscode/compileCommands_${project}.json" compile_commands.json	
        	replace_string="clang++ @'$(pwd)/clang-flags.txt'"
        	sed -i -e "s,$engine_path\(.*\)clang++,$replace_string,g" compile_commands.json
    	# Generate ctags for project and optionally the engine itself with `ue ctags` and `ue ctags engine` respectively.
	elif [[ "$1" == "ctags" ]]; then
	        if [[ "$2" == "engine" ]]; then
            		echo "Generating ctags database for unreal engine"
            		ctags -R --c++-kinds=+p --fields=+iaS --extras=+q --languages=C++ "$engine_path/Engine/Source"
			echo "Generation completed."
        	fi

		echo "Generating ctags database in current directory ..."
		ctags -R Source
		echo "Generation completed."
    	# Pass through all other commands to ue4
	else
		$ue4cli "$@"
	fi
}

alias ue4='echo Please use ue instead.'
alias ue5='echo Please use ue instead.'

Ctags

Navigating engine source code is not possible with coc or lsp because it would require a compile database of the engine. While I was able to generate one with the command below, I couldn't get it to work after all. Any help with this would be highly appreciated.

./Engine/Build/BatchFiles/Linux/Build.sh MyProjectName Linux Development '/path/to/myProject/myProject.uproject' -mode=GenerateClangDatabase

However, there is another solution: ctags. Simply install universal-ctags (e.g. with your package manager) and run the following command:

ctags -R --c++-kinds=+p --fields=+iaS --extras=+q --languages=C++ /path/to/your/unrealengine/Engine/Source

When the cursor is over a symbol that was found by ctags, Ctrl+] will let you jump to the tag using the newly generated tags file. I usually run the command above in my project's root directory, so that no additional configuration is required for (N)vim to find the file.

Clang-tidy

Yes, you can even get static analysis in your code. All you need is a file named .clang-tidy in your project's root directory. Creating this file was quite the hassle since a lot of the tests that clang-tidy runs just don't make any sense when working with Unreal Engine and trying to follow the guidelines. As a starting point, you can use my version:

---
Checks:          'clang-diagnostic-*,misc-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,modernize-*,-modernize-use-trailing-return-type,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-special-member-functions,-readability-avoid-const-params-in-decls,-misc-unused-parameters,-readability-named-parameter,-readability-magic-numbers,-misc-non-private-member-variables-in-classes,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-avoid-magic-numbers,-modernize-use-auto,-cppcoreguidelines-pro-type-union-access,-bugprone-easily-swappable-parameters'
WarningsAsErrors: false
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle:     google
CheckOptions:
  - key:             cert-dcl16-c.NewSuffixes
    value:           'L;LL;LU;LLU'
  - key:             cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
    value:           '0'
  - key:             cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
    value:           '1'
  - key:             cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
    value:           '1'
  - key:             google-readability-braces-around-statements.ShortStatementLines
    value:           '1'
  - key:             google-readability-function-size.StatementThreshold
    value:           '800'
  - key:             google-readability-namespace-comments.ShortNamespaceLines
    value:           '10'
  - key:             google-readability-namespace-comments.SpacesBeforeComments
    value:           '2'
  - key:             modernize-loop-convert.MaxCopySize
    value:           '16'
  - key:             modernize-loop-convert.MinConfidence
    value:           reasonable
  - key:             modernize-loop-convert.NamingStyle
    value:           CamelCase
  - key:             modernize-pass-by-value.IncludeStyle
    value:           llvm
  - key:             modernize-replace-auto-ptr.IncludeStyle
    value:           llvm
  - key:             modernize-use-nullptr.NullMacros
    value:           'NULL'
...

Clang-format

Consider using a .clang-format to automatically format your code in all of your projects. This one is probably the best you can find online. Simply place it in your project's root directory. One thing I disliked about having .clang-format in the root directory is that it would format everything, including the Plugins folder. As a quick workaround, I put the following .clang-format in the Plugins folder:

DisableFormat: true
SortIncludes: false

UE 5.1

The steps above still work after recompiling the engine. However, you have to clean build and delete both .vscode and compile_commands.json before running my custom ue gen override. Also make sure to adjust the respective line with the sed command to replace_string="clang++\"\,\n\t\t\t\"@$(pwd)/clang-flags.txt\"\,".

Misc

If you are on Arch and experience long loading times when starting the editor (UE4 only) follow the instructions on the Arch Wiki. It really makes a difference.

Let me know if you have any suggestions or ideas to make UE development in (Neo)vim even better.

Tested on

OS - Arch Linux VIM - Vi IMproved 8.2 NVIM - 0.7.2 coc.nvim - 0.0.80 clangd - 12.0.1 Unreal - 4.28 Vimspector - Build 1284234985

@chillpert
Copy link
Author

chillpert commented Aug 28, 2022

I might know what the issue is. Can you add the full path to the source file (no @ or anything required) in between where you specify your clang flags file and the rsp file and try it again? If that solves the issue, you might need to do that for the entire compile database. I think I included this step in previous versions of the gist but at some point it worked for me without doing the extra step, so I thought I can remove it. If that fixes the issue, I will update the gist and add it to the instructions again. I also wrote a little script that automates this step for the entire compile database at some point. If I find it, I will link it here.

@Tonetfal
Copy link

clang++ @/home/jeki/ue/repository/MyProject/Source/clang-flags.txt @'/home/jeki/ue/repository/MyProject/.vscode/compileCommands_MyProject/MyProject.199.rsp'

Do you mean this?

clang++ \
       @'/home/jeki/ue/repository/MyProject/Source/clang-flags.txt' \
       '/home/jeki/ue/repository/MyProject/Source/MyProject/Private/Test.cpp' \
       @'/home/jeki/ue/repository/MyProject/.vscode/compileCommands_MyProject/MyProject.199.rsp'

If so, the error related to flags still persists (the actual file exists, just saying), I'll paste it once again to clarify myself

clang-14: error: no such file or directory: '@/home/jeki/ue/repository/MyProject/Source/clang-flags.txt'

@chillpert
Copy link
Author

Yes. The only things I can still think of is trying to remove the quotation marks and double checking that clang-flags.txt really is in that location.

@Tonetfal
Copy link

I'm so dumb, I didn't specify a subdirectory where the flags are located... Nevertheless I have another issue now: the command runs "fine", the compilation gives 4075 warning and 9 errors. All the errors are related to unknown type name nullptr_t, and it suggests std::nullptr_t instead. Any ideas how to fix it?

@chillpert
Copy link
Author

It is common that you will still end up with some errors and a lot of warnings when compiling in the terminal like that. Is this error about the nullptr types also visible as a linting error inside of vim or only in the terminal?

@Tonetfal
Copy link

I don't have any global nullptr_t declared/defined in my actor class, I only have nullptr and std::nullptr_t, I don't know if it's an actual problem though.
Now if I open the header file I have Too many errors emitted, stopping now on #pragma once, and Cannot initialize return object of type 'UObject*' with an rvalue of type 'ATest*' on GENERATED_BODY(). On the other hand, source file is full of errors, each function call has its own error.

@chillpert
Copy link
Author

So did you adjust the entire compile database by adding the respective source file to each command entry? And that made it worse?

@Tonetfal
Copy link

No, I didn't add it. The only modification I've made to the compile_commands is the @'/home/jeki/ue/repository/MyProject/Source/clang-flags.txt' after clang++, as stated in the guide. In the last messages I said that I was trying to run the compilation command by hand (as you asked); as a result the compilation did run, but with no success. I'm not sure if it became worse, but the error messages just changed.
What else should I add to the command entry?

@chillpert
Copy link
Author

I updated the gist right below the sample of the compile database. If making those adjustments doesn't fix your problems, then I am out of ideas for now, unfortunately.
You have to do this with all entries. Depending on how large your compile database is, I recommend creating a fresh project with only one source file for quick testing.

@Tonetfal
Copy link

I tried to redo everything from scratch, and I noticed a small mistake in the guide, here on point 2 it has to be Tools - Refresh Visual Studio Code Project instead.

To test if it works I created a new project with a template Actor within the editor, refreshed the project with the Refresh VS Code Project button also within the editor, and then quitted it.

After it I created a symlink called for compile_commands, and then modified it so the commands had the compilation flags and the file to compile after path to the shipped clang (the whole order was right: flags - cpp - rsp); unfortunately it didn't work, I had many errors, but by using my clang instead it did work almost perfectly, almost on the templated Actor class: it said only Extra ';' inside a class after GENERATED_BODY(), not a big deal actually.
The syntax highlighting wasn't correct, for example my public and protected modifiers after GENERATED_BODY() were wrong. The same thing with the cpp file: return type, argument types, function names were of the wrong color. Screenshot

Then I decided to check the intellisense help, so I thought about creating an USphereComponent, so I forward declared it, but as a result I got some errors: UCLASS() gave me Unknown type name 'FID_TestProject_Source_TestProject_Public_MyActor_h_11_PROLOG', and GENERATED_BODY() gave me C++ requires a type specifier for all declarations. If I include the header file defining the SphereComponent I get almost the same errors, but the error generated on UCLASS() has 10 instead of 11 at the end.

Sadly, that's my final situation for now. :(

My final compile_commands.json.

@chillpert
Copy link
Author

You also need to add the header files for each command entry. Hopefully that will fix the remaining issues!

@Tonetfal
Copy link

What exactly do you mean by that? Do I need to add respective cpp file to a header file command? I mean, if I'm editing a header file command, do I need to add its cpp file right between the clang-flags.txt and the rsp file? So, if I'm editing MyActor.h, the command will become

"command": "clang++ @'/mnt/ue5/repository/TestProject/clang-flags.txt' /mnt/ue5/repository/TestProject/Source/TestProject/Private/MyActor.cpp @/mnt/ue5/repository/TestProject/.vscode/compileCommands_TestProject/TestProject.199.rsp",

instead of

"command": "clang++ @'/mnt/ue5/repository/TestProject/clang-flags.txt' @/mnt/ue5/repository/TestProject/.vscode/compileCommands_TestProject/TestProject.199.rsp",

And the compile_commands.json will look like this.

If so, nothing changed, I still have the same 2 errors in my header file. :(

@chillpert
Copy link
Author

You almost got it right, but if the file in "file": is a header, you have to add this exact file after the clang-flags.txt:

	{
		"file": "/mnt/ue5/repository/TestProject/Source/TestProject/Public/MyActor.h",
		"command": "clang++ @'/mnt/ue5/repository/TestProject/clang-flags.txt' /mnt/ue5/repository/TestProject/Source/TestProject/Public/MyActor.h @/mnt/ue5/repository/TestProject/.vscode/compileCommands_TestProject/TestProject.199.rsp",
		"directory": "/mnt/ue5/UnrealEngine/Engine/Source"
	},

Your source file entries are correct already.

@Tonetfal
Copy link

I gave it a try, and that's the new file. Sadly, it doesn't work either; the error messages are still the same.
I tried to change the directory entry by appending Public for header files (only for MyActor.h) and Private for source files (only for MyActor.cpp), but it didn't make any visible difference, so I removed this last thing.

@chillpert
Copy link
Author

I gave it a try, and that's the new file. Sadly, it doesn't work either; the error messages are still the same. I tried to change the directory entry by appending Public for header files (only for MyActor.h) and Private for source files (only for MyActor.cpp), but it didn't make any visible difference, so I removed this last thing.

@JekiTheMonkey Sorry for the late reply, could you perhaps publish this test repo on GitHub? I could clone it and see if it works on my end at least.

@Tonetfal
Copy link

Tonetfal commented Sep 9, 2022

I gave it a try, and that's the new file. Sadly, it doesn't work either; the error messages are still the same. I tried to change the directory entry by appending Public for header files (only for MyActor.h) and Private for source files (only for MyActor.cpp), but it didn't make any visible difference, so I removed this last thing.

@JekiTheMonkey Sorry for the late reply, could you perhaps publish this test repo on GitHub? I could clone it and see if it works on my end at least.

Sure, that's it. I couldn't push the whole directory because it's too large, so I just uploaded all the files that I thought are required to setup LSP. Hopefully that's enough.

@chillpert
Copy link
Author

chillpert commented Sep 9, 2022

Thank you! It works perfectly fine on my end. All I did was clone the repo, run ue4 build and ue4 gen, and updated the compile database accordingly. The only noticeable difference is that I cloned the project into my home directory, but I doubt that is the problem.

Tested with:
Clang 14.0.6
Arch Linux
UE 5.0.3
Neovim 0.7.2
And the latest version of all my Neovim plugins as of writing

@SrMrBurchick
Copy link

Hello there. I've made an plugin for Unreal Engine that provides ability to use Neoivim as Source Code editor. Here is the demo

@Tonetfal
Copy link

Oh, I didn't know that I need to run ue4 build and ue4 gen commands to make it work. I tried to run them, but I get an error on the last one; the whole command output:

Using user-specified engine root: /home/jeki/ue/UnrealEngine

Setting up Unreal Engine 5 project files...

Setting up bundled DotNet SDK
/mnt/ue5/UnrealEngine/Engine/Binaries/ThirdParty/DotNet/Linux/sdk/3.1.401/Microsoft.Common.CurrentVersion.targets(2084,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Ionic.Zip.Reduced". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/home/jeki/ue/UnrealEngine/Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj]
Platform/Android/AndroidAARHandler.cs(13,7): error CS0246: The type or namespace name 'Ionic' could not be found (are you missing a using directive or an assembly reference?) [/home/jeki/ue/UnrealEngine/Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj]
Platform/IOS/IOSToolChain.cs(14,7): error CS0246: The type or namespace name 'Ionic' could not be found (are you missing a using directive or an assembly reference?) [/home/jeki/ue/UnrealEngine/Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj]
Platform/IOS/IOSToolChain.cs(15,7): error CS0246: The type or namespace name 'Ionic' could not be found (are you missing a using directive or an assembly reference?) [/home/jeki/ue/UnrealEngine/Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj]
Platform/Mac/MacToolChain.cs(11,7): error CS0246: The type or namespace name 'Ionic' could not be found (are you missing a using directive or an assembly reference?) [/home/jeki/ue/UnrealEngine/Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj]
Platform/Mac/UEDeployMac.cs(10,7): error CS0246: The type or namespace name 'Ionic' could not be found (are you missing a using directive or an assembly reference?) [/home/jeki/ue/UnrealEngine/Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj]
Platform/TVOS/TVOSToolChain.cs(13,7): error CS0246: The type or namespace name 'Ionic' could not be found (are you missing a using directive or an assembly reference?) [/home/jeki/ue/UnrealEngine/Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj]
Platform/TVOS/TVOSToolChain.cs(14,7): error CS0246: The type or namespace name 'Ionic' could not be found (are you missing a using directive or an assembly reference?) [/home/jeki/ue/UnrealEngine/Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj]
GenerateProjectFiles ERROR: Failed to build UnrealBuildTool
Traceback (most recent call last):
  File "/home/jeki/.local/bin/ue4", line 8, in <module>
    sys.exit(main())
  File "/home/jeki/.local/lib/python3.10/site-packages/ue4cli/cli.py", line 222, in main
    SUPPORTED_COMMANDS[command]['action'](manager, args)
  File "/home/jeki/.local/lib/python3.10/site-packages/ue4cli/cli.py", line 70, in <lambda>
    'action': lambda m, args: m.generateProjectFiles(os.getcwd(), args),
  File "/home/jeki/.local/lib/python3.10/site-packages/ue4cli/UnrealManagerBase.py", line 306, in generateProjectFiles
    Utility.run([genScript, '-project=' + projectFile, '-game', '-engine'] + args, cwd=os.path.dirname(genScript), raiseOnError=True)
  File "/home/jeki/.local/lib/python3.10/site-packages/ue4cli/Utility.py", line 145, in run
    raise Exception('child process ' + str(command) + ' failed with exit code ' + str(returncode))
Exception: child process ['/home/jeki/ue/UnrealEngine/Engine/Build/BatchFiles/Linux/GenerateProjectFiles.sh', '-project=/mnt/ue5/repository/MyProject/MyProject.uproject', '-game', '-engine'] failed with exit code 1

Do you have any ideas how to fix that?

@chillpert
Copy link
Author

@JekiTheMonkey You shouldn't need to run these commands to make it work, but it's just faster this way.
I thought you had your UE located somewhere in /mnt but the first line in the output says it is in /home now. In case you have changed the installation location, you might need to re-run Setup.sh.
Also, which version of UE5 are you using? There might be a fix for this problem in 5.0.3 (check this PR).

@chillpert
Copy link
Author

chillpert commented Sep 11, 2022

Hello there. I've made an plugin for Unreal Engine that provides ability to use Neoivim as Source Code editor. Here is the demo

That's nice! I assume with these changes you no longer need to have vscode installed? I guess vscode is still required to get the compile database after all. I wonder if you can still generate the compile database with ue4 gen even if vscode is not set as the source code editor.

Edit: The compile database can be generated without vscode, but creating classes using the editor won't. Does adding source files from inside the editor work with your PR?

@Tonetfal
Copy link

@JekiTheMonkey You shouldn't need to run these commands to make it work, but it's just faster this way. I thought you had your UE located somewhere in /mnt but the first line in the output says it is in /home now. In case you have changed the installation location, you might need to re-run Setup.sh. Also, which version of UE5 are you using? There might be a fix for this problem in 5.0.3 (check this PR).

I have a disk called ue, as well as its link in the /home directory, so it can be accessed both by /mnt/ue and /home/ue. I'm using the latest version, only if it wasn't updated on Linux since my first messages in here.

@chillpert
Copy link
Author

@JekiTheMonkey You shouldn't need to run these commands to make it work, but it's just faster this way. I thought you had your UE located somewhere in /mnt but the first line in the output says it is in /home now. In case you have changed the installation location, you might need to re-run Setup.sh. Also, which version of UE5 are you using? There might be a fix for this problem in 5.0.3 (check this PR).

I have a disk called ue, as well as its link in the /home directory, so it can be accessed both by /mnt/ue and /home/ue. I'm using the latest version, only if it wasn't updated on Linux since my first messages in here.

I assume if you run /home/jeki/ue/UnrealEngine/Engine/Build/BatchFiles/Linux/GenerateProjectFiles.sh -project=/mnt/ue5/repository/MyProject/MyProject.uproject -game -engine, you will get the same error?

@Tonetfal
Copy link

@JekiTheMonkey You shouldn't need to run these commands to make it work, but it's just faster this way. I thought you had your UE located somewhere in /mnt but the first line in the output says it is in /home now. In case you have changed the installation location, you might need to re-run Setup.sh. Also, which version of UE5 are you using? There might be a fix for this problem in 5.0.3 (check this PR).

I have a disk called ue, as well as its link in the /home directory, so it can be accessed both by /mnt/ue and /home/ue. I'm using the latest version, only if it wasn't updated on Linux since my first messages in here.

I assume if you run /home/jeki/ue/UnrealEngine/Engine/Build/BatchFiles/Linux/GenerateProjectFiles.sh -project=/mnt/ue5/repository/MyProject/MyProject.uproject -game -engine, you will get the same error?

Yes, I do, but it's smaller since it doesn't have the ue4 error information

@chillpert
Copy link
Author

@JekiTheMonkey Can you at least successfully run ./GenerateProjectFiles.sh in your UE directory?

@Tonetfal
Copy link

@chillpert It gives me the same error.
I tried to search for the error a bit, and apparently dotnet just can't find it, even if it is installed. I also tried to install it manually, but it still can't find it.

@chillpert
Copy link
Author

@chillpert It gives me the same error. I tried to search for the error a bit, and apparently dotnet just can't find it, even if it is installed. I also tried to install it manually, but it still can't find it.

The PR I was talking about is apparently not yet part of any official release. I would suggest just quickly applying the patch and checking if it does fix your issue.

@Tonetfal
Copy link

I have applied the patch, and now it runs succesfully, but, sadly, the errors in nvim still appear.

@julkip
Copy link

julkip commented Dec 20, 2022

I want to say a huge thank you for this. It helped me tremendously in getting autocompletion working and it inspired me to write my own little guide. I also have got debugging with nvim-dap working and have improved your zsh-alias a little bit. Maybe you want to take a look?
https://neunerdhausen.de/posts/unreal-engine-5-with-vim/

@chillpert
Copy link
Author

I want to say a huge thank you for this. It helped me tremendously in getting autocompletion working and it inspired me to write my own little guide. I also have got debugging with nvim-dap working and have improved your zsh-alias a little bit. Maybe you want to take a look? https://neunerdhausen.de/posts/unreal-engine-5-with-vim/

I am glad my little guide was useful. How in the world have I never heard of the epic asset manager? It's fantastic. Finally I no longer need to get plugins by running the EGS with Wine, amazing! Thank you for figuring out debugging as well!

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