Lines 46-58
toc::[]
Link Here
|
46 |
[[intro]] |
46 |
[[intro]] |
47 |
== Introduction |
47 |
== Introduction |
48 |
|
48 |
|
49 |
This guide is about setting up a FreeBSD src tree with language servers performing source code indexing. |
49 |
This guide is about setting up a FreeBSD src tree with language servers performing source code indexing. The guide describes the steps for Vim/NeoVim and VSCode. If you use a different text editor you can use this guide as a reference and search the equivalent commands for your preferred editor. |
50 |
|
50 |
|
51 |
[[ports-required]] |
51 |
[[requirements]] |
52 |
== Required Ports |
52 |
== Requirements |
53 |
|
53 |
|
54 |
Some ports are required throughout the guide. |
54 |
In order to follow this guide we need to install certain requirements. We need a Language server, `ccls` or `clangd`, and optionally a compilation database. |
55 |
Choose a favorite combination of tools from each category below: |
55 |
|
|
|
56 |
The installation of the Language server can be performed via `pkg` or via ports. If we chose `clangd` we need to install `llvm`. |
57 |
|
58 |
Using `pkg` to install `ccls`: |
59 |
|
60 |
[source,shell] |
61 |
.... |
62 |
# pkg install ccls |
63 |
.... |
64 |
|
65 |
If we want to use `clangd` we need to install `llvm` (The example command uses `llvm15` but choose the version you desire): |
66 |
|
67 |
[source,shell] |
68 |
.... |
69 |
# pkg install llvm15 |
70 |
.... |
71 |
|
72 |
To install via ports choose a favorite combination of tools from each category below: |
56 |
|
73 |
|
57 |
* Language server implementations |
74 |
* Language server implementations |
58 |
** package:devel/ccls[] |
75 |
** package:devel/ccls[] |
Lines 114-125
au User lsp_setup call lsp#register_server({
Link Here
|
114 |
.... |
131 |
.... |
115 |
au User lsp_setup call lsp#register_server({ |
132 |
au User lsp_setup call lsp#register_server({ |
116 |
\ 'name': 'clangd', |
133 |
\ 'name': 'clangd', |
117 |
\ 'cmd': {server_info->['clangd12', '--background-index', '--header-insertion=never']}, |
134 |
\ 'cmd': {server_info->['clangd15', '--background-index', '--header-insertion=never']}, |
118 |
\ 'allowlist': ['c', 'cpp', 'objc'], |
135 |
\ 'allowlist': ['c', 'cpp', 'objc'], |
119 |
\ 'initialization_options': {}, |
136 |
\ 'initialization_options': {}, |
120 |
\ }) |
137 |
\ }) |
121 |
.... |
138 |
.... |
122 |
|
139 |
|
|
|
140 |
Depending on the version that you installed for `clangd` you might need to update the `server-info` to point to the correct binary. |
141 |
|
123 |
Please refer to link:https://github.com/prabirshrestha/vim-lsp/blob/master/README.md#registering-servers[] to learn about setting up key bindings and code completion. |
142 |
Please refer to link:https://github.com/prabirshrestha/vim-lsp/blob/master/README.md#registering-servers[] to learn about setting up key bindings and code completion. |
124 |
The official site of clangd is link:https://clangd.llvm.org[], and the repository link of ccls is link:https://github.com/MaskRay/ccls/[]. |
143 |
The official site of clangd is link:https://clangd.llvm.org[], and the repository link of ccls is link:https://github.com/MaskRay/ccls/[]. |
125 |
|
144 |
|
126 |
- |
|
|