Hello, I was beginning to learn some Programming through tutorials on Unreal Engine, and I would really like to use Kate as my editor, so I was wondering if there was a way for me to allow Kate to know the keywords specific to Unreal Engine (UE_LOG, EditAnywhere/VisibleAnywhere) and so on so that it can accurately tell me if I’m misspelling function calls and give me relevant auto completes.
LSP plugin can do that. You will need a compile_commands.json file which CMake (and other build systems) can produce for you automatically.
I haven’t had much opportunity to work with Cmake all that much, unreal engine does give me a Makefile but not a Cmakefile, there are some VScode ‘compile_commands_default.json’ and similar files in the created project, but when I go to Settings > configure kate > LSP Client > user server settings and open that file and apply, I get “Failed to parse server configuration ‘/file/path/compilecommands_default.json’ no json object”
Try renaming compile_commands_default.json to compile_commands.json and put it in the root of your project. Then install clangd (downloadable from here Releases · clangd/clangd · GitHub) and make sure it is in your PATH. Then restart Kate and open a cpp file, it should be able to start giving you intellisense if the compile_commands.json file is correct.
Settings > configure kate > LSP Client > user server settings and open that file and apply, I get “Failed to parse server configuration ‘/file/path/compilecommands_default.json’ no json object
Don’t do that. That config is for something different. Leave it empty for now.
The basic idea behind this is simple. LSP is a protocol that is used to provide intellisense and IDE like features. There is a server e.g., (clangd) which does the hard work of understanding and parsing your code and a client (Kate) which talks to the server and gives you an interface for the data the the server is providing.
The server needs to know how to parse your code, how to find the #includes etc. It uses the compile_commands.json (also known as Compilation database) to do that. So a bad compile_commands will give you bad/incorrect intellisense. Read more clangd here https://clangd.llvm.org/
Some build tools dont give you a compile database. You can use something like GitHub - rizsotto/Bear: Bear is a tool that generates a compilation database for clang tooling. to produce one.
Hope this helps
Thank you! Simply renaming that file generated by unreal engine for vscode and moving it to the root of the project did the trick!
I ignorantly thought the LSP client / user settings was for me to give it the file I had generated for compile commands.
The cpp file gives me a few squiggly lines based on my own created classes and objects, I do have clang, and clangd in my /bin directory, I assume from the arch clang, and possibly llvm packages. Does this squiggly look like something I’d just have to deal with in my own projects or is there a way I could fix this? As my project builds and runs correctly, there shouldn’t be any errors of initializing these, I can see that they work when I run the built project.
[clang] (member_function_call_bad_type) Cannot initialize object parameter of type 'AActor' with an expression of type 'AMovingPlatform'
If it builds and the error is in a .cpp file, then most likely the compile_commands produced by vscode aren’t 100% correct. You can try to use bear instead which will produce compile commands that match the real commands used to compile your project.
I thank you once again, now my only squigglies are from things unreal automatically adds as #include’s but aren’t used, and therefore the squiggly lines are telling me I’m including headers and not using them ![]()
I apologize if such questions came off as insignificant, I didn’t have enough knowledge to know what to google or look into to help myself on this topic.