docs/develop/ide: A quick guide for haiku code completion
* Works under a Linux "cross-compile" environment * We can't check in compile_commands.json unforunetly because it highly depends on your build environment * An in-tree .clangd is a thing, but our includes are complex and directory-spefific. * Thanks to Pulkomandy for adding the flag to jam to do this! Change-Id: I3be4084c43f7b822bb04ea7ec527c5fbe03d7289 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7158 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Adrien Destugues <[email protected]> Reviewed-by: Alex von Gluck IV <[email protected]>
This commit is contained in:
committed by
Alex von Gluck IV
parent
9bc1ff61eb
commit
3634f14235
@@ -22,3 +22,6 @@ build/user_config_headers
|
|||||||
|
|
||||||
# Project settings of the Genio IDE
|
# Project settings of the Genio IDE
|
||||||
.genio
|
.genio
|
||||||
|
|
||||||
|
# clangd related tooling for IDE code completion
|
||||||
|
compile_commands.json
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
Using an IDE
|
||||||
|
===============
|
||||||
|
|
||||||
|
Live Code Analysis
|
||||||
|
------------------
|
||||||
|
While developing the Haiku codebase, it is possible to generate an inventory of compile commands
|
||||||
|
by passing the **-c** flag to jam. The resulting **compile_commands.json** document will assist
|
||||||
|
tools such as clangd_ in live analyzing our source code.
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
:caption: Generating the **compile_commands.json** for clangd:
|
||||||
|
|
||||||
|
$ mkdir generated.clangd && cd generated.clangd
|
||||||
|
$ configure --build-cross-tools x86_64 --cross-tools-source ../../buildtools
|
||||||
|
$ jam -anc @nightly-anyboot
|
||||||
|
$ ln -sr compile_commands.json ../compile_commands.json
|
||||||
|
|
||||||
|
|
||||||
|
When you use an editor which supports clangd_ such as helix_ or vim_ (with the clangd plugin),
|
||||||
|
clangd_ will have knowledge of the relevant include paths and build flags for every source file
|
||||||
|
within the Haiku codebase.
|
||||||
|
|
||||||
|
.. TIP::
|
||||||
|
When new source code files are added, you will need to run though the process above for a
|
||||||
|
complete database.
|
||||||
|
|
||||||
|
.. _helix: http://helix-editor.com
|
||||||
|
.. _vim: http://vim.org
|
||||||
|
.. _clangd: http://clangd.llvm.org
|
||||||
@@ -7,4 +7,5 @@ The build system
|
|||||||
/build/jam
|
/build/jam
|
||||||
/build/sourcecode
|
/build/sourcecode
|
||||||
/build/compilers
|
/build/compilers
|
||||||
|
/build/ide
|
||||||
/build/repositories/README
|
/build/repositories/README
|
||||||
|
|||||||
Reference in New Issue
Block a user