=== Enabling Advanced Code Editing Features for Compiled Languages

As explained thoroughly before, in the section devoted the the SDK Build Engine, file system paths involved at build time do not always exist on the host file system (where sfdk is executed). This may prevent advanced code editors and other tools from determining all information required for successfully parsing each translation unit.

Beside this issue specific to %{SdkVariant}, a more general issue exists that a code editor or tool may not be capable of retrieving the required information from the build system utilized by a particular project. This is commonly adressed with the help of Clang's JSON Compilation Database format used as an interchangeable project description suitable for loading by tools. The same approach is applicable to the above mentioned issue.

sfdk supports generating a compilation database conveniently with the 'compiledb' subcommand.

As an example consider using the ViM editor with YouCompleteMe plugin installed.

    $ mkdir my-app && cd my-app
    $ sfdk init --type qtquick
    $ sfdk compiledb
    $ vim src/my-app.cpp

With the YouCompleteMe plugin ViM looks for 'compile_commands.json' file up the file system hierarchy starting from the directory when the file being edited exists, so at this point it should be all set up, autocompleting identifiers from the 'SailfishApp' namespace and more.

See the 'compiledb' command description for details and to learn how to adjust the default behavior.
