git: 5070568cdd - main - Add pkg install clarification to FreeBSD src lsp article
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 28 Jan 2023 10:48:59 UTC
The branch main has been updated by carlavilla: URL: https://cgit.FreeBSD.org/doc/commit/?id=5070568cdd839adae70b1085cf7fd173f55c274a commit 5070568cdd839adae70b1085cf7fd173f55c274a Author: Derik <derik@rderik.com> AuthorDate: 2023-01-28 10:47:54 +0000 Commit: Sergio Carlavilla Delgado <carlavilla@FreeBSD.org> CommitDate: 2023-01-28 10:47:54 +0000 Add pkg install clarification to FreeBSD src lsp article PR: 269137 --- .../en/articles/freebsd-src-lsp/_index.adoc | 31 +++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/documentation/content/en/articles/freebsd-src-lsp/_index.adoc b/documentation/content/en/articles/freebsd-src-lsp/_index.adoc index 8b6647833f..ac916d756e 100644 --- a/documentation/content/en/articles/freebsd-src-lsp/_index.adoc +++ b/documentation/content/en/articles/freebsd-src-lsp/_index.adoc @@ -46,13 +46,30 @@ toc::[] [[intro]] == Introduction -This guide is about setting up a FreeBSD src tree with language servers performing source code indexing. +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. -[[ports-required]] -== Required Ports +[[requirements]] +== Requirements -Some ports are required throughout the guide. -Choose a favorite combination of tools from each category below: +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. + +The installation of the Language server can be performed via `pkg` or via ports. If we chose `clangd` we need to install `llvm`. + +Using `pkg` to install `ccls`: + +[source,shell] +.... +# pkg install ccls +.... + +If we want to use `clangd` we need to install `llvm` (The example command uses `llvm15` but choose the version you desire): + +[source,shell] +.... +# pkg install llvm15 +.... + +To install via ports choose a favorite combination of tools from each category below: * Language server implementations ** package:devel/ccls[] @@ -114,12 +131,14 @@ au User lsp_setup call lsp#register_server({ .... au User lsp_setup call lsp#register_server({ \ 'name': 'clangd', - \ 'cmd': {server_info->['clangd12', '--background-index', '--header-insertion=never']}, + \ 'cmd': {server_info->['clangd15', '--background-index', '--header-insertion=never']}, \ 'allowlist': ['c', 'cpp', 'objc'], \ 'initialization_options': {}, \ }) .... +Depending on the version that you installed for `clangd` you might need to update the `server-info` to point to the correct binary. + 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. The official site of clangd is link:https://clangd.llvm.org[], and the repository link of ccls is link:https://github.com/MaskRay/ccls/[].