VS code IDE integration for LibreOffice

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:

      1. Build LibreOffice.. (make check)
      2. Create compile_commands.json with the following command:
        make vim-ide-integration
      3. Install VS code, but I guess you did it already.
      4. Install the C++ extension.
      5. File -> Preferences -> Settings -> Workspace Settings -> Extensions -> C/C++. Find a link to your settings.json file.
      6. Insert the following line:
"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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s