Changeset View
Changeset View
Standalone View
Standalone View
documentation/content/en/articles/freebsd-src-lsp/_index.adoc
Show First 20 Lines • Show All 228 Lines • ▼ Show 20 Lines | |||||
==== Using devel/bear | ==== Using devel/bear | ||||
===== Usage | ===== Usage | ||||
In the top-level directory of the FreeBSD src tree, to generate compilation database with `bear`: | In the top-level directory of the FreeBSD src tree, to generate compilation database with `bear`: | ||||
[source,shell] | [source,shell] | ||||
.... | .... | ||||
# bear -a make buildworld buildkernel -j`sysctl -n hw.ncpu` | # bear --append make buildworld buildkernel -j`sysctl -n hw.ncpu` | ||||
.... | .... | ||||
The `-a` flag tells `bear` to read an existing compilation database if it is present, and append the results to the database. | The `--append` flag tells `bear` to read an existing compilation database if it is present, and append the results to the database. | ||||
Entries with duplicated command key are merged. | Entries with duplicated command key are merged. | ||||
The generated compilation database by default is saved in the current working directory as [.filename]#compiler_commands.json#. | The generated compilation database by default is saved in the current working directory as [.filename]#compiler_commands.json#. | ||||
[[final]] | [[final]] | ||||
== Final | == Final | ||||
Once the compilation database is generated, open any source files in the FreeBSD src tree and LSP server daemon will be launched as well in background. | Once the compilation database is generated, open any source files in the FreeBSD src tree and LSP server daemon will be launched as well in background. | ||||
Opening source files in the src tree for the first time takes significantly longer time before the LSP server is able to give a complete result, due to initial background indexing by the LSP server compiling all the listed entries in the compilation database. | Opening source files in the src tree for the first time takes significantly longer time before the LSP server is able to give a complete result, due to initial background indexing by the LSP server compiling all the listed entries in the compilation database. | ||||
The language server daemon however does not index the source files not appearing in the compilation database, thus no complete results are shown on source files not being compiled during the `make`. | The language server daemon however does not index the source files not appearing in the compilation database, thus no complete results are shown on source files not being compiled during the `make`. |