Successfully submitting a very first patch to LibreOffice can be quite challenging. Not only because you have to deal with the build dependencies first, but because the project doesn’t come with a default/suggested development environment. Even though it can be annoying, it is actually a good thing, because you can use your favorite. In this blog post I want to show you how to use VS code for LibreOffice hacking:
-
-
- Build LibreOffice.. (
make check
) - Create compile_commands.json with the following command:
make vim-ide-integration
- Install VS code, but I guess you did it already.
- Install the C++ extension.
- File -> Preferences -> Settings -> Workspace Settings -> Extensions -> C/C++. Find a link to your settings.json file.
- Insert the following line:
- Build LibreOffice.. (
-
"C_Cpp.default.compileCommands":"${workspaceFolder}/compile_commands.json"
The compile_commands.json file helps the IDE find all the include paths/dependencies. Luckily, VS code can use the same structure as the YouCompleteMe code-completion engine for vim. The above line in settings.json specifies the location of the file relative to the workspace folder.
After this the semantic code completion features (code completion, Goto Definition, …) should work. In order to get debug working, you can follow this description. For handy tricks you should take a look at this and this.
Disclaimer: I couldn’t configure the debugger which symbols to load. It doesn’t affect the code completion features, but for the debugging – unless you know how to restrict symbol loading (then tell me in a comment) – you’ll need more than 8 GB of RAM.