|
1 |
| -============ |
2 |
| -Clangd |
3 |
| -============ |
4 |
| - |
5 |
| -.. contents:: |
6 |
| - |
7 |
| -.. toctree:: |
8 |
| - :maxdepth: 1 |
9 |
| - |
10 |
| -:program:`Clangd` is an implementation of the `Language Server Protocol |
11 |
| -<https://github.com/Microsoft/language-server-protocol>`_ leveraging Clang. |
12 |
| -Clangd's goal is to provide language "smartness" features like code completion, |
13 |
| -find references, etc. for clients such as C/C++ Editors. |
14 |
| - |
15 |
| -Using Clangd |
16 |
| -================== |
17 |
| - |
18 |
| -:program:`Clangd` is not meant to be used by C/C++ developers directly but |
19 |
| -rather from a client implementing the protocol. A client would be typically |
20 |
| -implemented in an IDE or an editor. |
21 |
| - |
22 |
| -At the moment, `Visual Studio Code <https://code.visualstudio.com/>`_ is mainly |
23 |
| -used in order to test :program:`Clangd` but more clients are likely to make |
24 |
| -use of :program:`Clangd` in the future as it matures and becomes a production |
25 |
| -quality tool. If you are interested in trying :program:`Clangd` in combination |
26 |
| -with Visual Studio Code, you can start by `installing Clangd`_ or |
27 |
| -`building Clangd`_, then open Visual Studio Code in the clangd-vscode folder and |
28 |
| -launch the extension. |
29 |
| - |
30 |
| -Installing Clangd |
31 |
| -================== |
32 |
| - |
33 |
| -Packages are available for debian-based distributions, see the `LLVM packages |
34 |
| -page <http://apt.llvm.org/>`_. :program:`Clangd` is included in the |
35 |
| -`clang-tools` package. |
36 |
| -However, it is a good idea to check your distribution's packaging system first |
37 |
| -as it might already be available. |
38 |
| - |
39 |
| -Otherwise, you can install :program:`Clangd` by `building Clangd`_ first. |
40 |
| - |
41 |
| -Building Clangd |
42 |
| -================== |
43 |
| - |
44 |
| -You can follow the instructions for `building Clang |
45 |
| -<https://clang.llvm.org/get_started.html>`_ but "extra Clang tools" is **not** |
46 |
| -optional. |
47 |
| - |
48 |
| -Current Status |
49 |
| -================== |
50 |
| - |
51 |
| -Many features could be implemented in :program:`Clangd`. |
52 |
| -Here is a list of features that could be useful with the status of whether or |
53 |
| -not they are already implemented in :program:`Clangd` and specified in the |
54 |
| -Language Server Protocol. Note that for some of the features, it is not clear |
55 |
| -whether or not they should be part of the Language Server Protocol, so those |
56 |
| -features might be eventually developed outside :program:`Clangd` or as an |
57 |
| -extension to the protocol. |
58 |
| - |
59 |
| -+-------------------------------------+------------+----------+ |
60 |
| -| C/C++ Editor feature | LSP | Clangd | |
61 |
| -+=====================================+============+==========+ |
62 |
| -| Formatting | Yes | Yes | |
63 |
| -+-------------------------------------+------------+----------+ |
64 |
| -| Completion | Yes | Yes | |
65 |
| -+-------------------------------------+------------+----------+ |
66 |
| -| Diagnostics | Yes | Yes | |
67 |
| -+-------------------------------------+------------+----------+ |
68 |
| -| Fix-its | Yes | Yes | |
69 |
| -+-------------------------------------+------------+----------+ |
70 |
| -| Go to Definition | Yes | Yes | |
71 |
| -+-------------------------------------+------------+----------+ |
72 |
| -| Signature Help | Yes | Yes | |
73 |
| -+-------------------------------------+------------+----------+ |
74 |
| -| Document Highlights | Yes | Yes | |
75 |
| -+-------------------------------------+------------+----------+ |
76 |
| -| Rename | Yes | Yes | |
77 |
| -+-------------------------------------+------------+----------+ |
78 |
| -| Source hover | Yes | Yes | |
79 |
| -+-------------------------------------+------------+----------+ |
80 |
| -| Find References | Yes | No | |
81 |
| -+-------------------------------------+------------+----------+ |
82 |
| -| Code Lens | Yes | No | |
83 |
| -+-------------------------------------+------------+----------+ |
84 |
| -| Document Symbols | Yes | Yes | |
85 |
| -+-------------------------------------+------------+----------+ |
86 |
| -| Workspace Symbols | Yes | Yes | |
87 |
| -+-------------------------------------+------------+----------+ |
88 |
| -| Syntax and Semantic Coloring | No | No | |
89 |
| -+-------------------------------------+------------+----------+ |
90 |
| -| Code folding | No | No | |
91 |
| -+-------------------------------------+------------+----------+ |
92 |
| -| Call hierarchy | No | No | |
93 |
| -+-------------------------------------+------------+----------+ |
94 |
| -| Type hierarchy | No | No | |
95 |
| -+-------------------------------------+------------+----------+ |
96 |
| -| Organize Includes | No | No | |
97 |
| -+-------------------------------------+------------+----------+ |
98 |
| -| Quick Assist | No | No | |
99 |
| -+-------------------------------------+------------+----------+ |
100 |
| -| Extract Local Variable | No | No | |
101 |
| -+-------------------------------------+------------+----------+ |
102 |
| -| Extract Function/Method | No | No | |
103 |
| -+-------------------------------------+------------+----------+ |
104 |
| -| Hide Method | No | No | |
105 |
| -+-------------------------------------+------------+----------+ |
106 |
| -| Implement Method | No | No | |
107 |
| -+-------------------------------------+------------+----------+ |
108 |
| -| Gen. Getters/Setters | No | No | |
109 |
| -+-------------------------------------+------------+----------+ |
110 |
| - |
111 |
| -Editor Integration |
112 |
| -================== |
113 |
| - |
114 |
| -Any full-featured Language Server Protocol Client implementation should work |
115 |
| -with :program:`Clangd`. This `list |
116 |
| -<https://langserver.org/#implementations-client>`_ contains information about |
117 |
| -extensions and plugins that are known to work for different editors. |
118 |
| - |
119 |
| -Vim Integration |
120 |
| ---------------- |
121 |
| - |
122 |
| -LanguageClient-neovim |
123 |
| -~~~~~~~~~~~~~~~~~~~~~ |
124 |
| - |
125 |
| -One of the options of using :program:`Clangd` in :program:`vim` (or |
126 |
| -:program:`nvim`) is to utilize `LanguageClient-neovim |
127 |
| -<https://github.com/autozimu/LanguageClient-neovim>`_ plugin. Please see the |
128 |
| -`Clangd Wiki page |
129 |
| -<https://github.com/autozimu/LanguageClient-neovim/wiki/Clangd>`_ for |
130 |
| -instructions. |
131 |
| - |
132 |
| -VSCode Integration |
133 |
| ------------------- |
134 |
| - |
135 |
| -:program:`VSCode` provides `vscode-clangd |
136 |
| -<https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd>`_ |
137 |
| -which is published in Visual Studio Marketplace and can be installed direcetly |
138 |
| -from :program:`VSCode`. |
139 |
| - |
140 |
| -Emacs Integration |
141 |
| ------------------ |
142 |
| - |
143 |
| -:program:`Emacs` provides `lsp-mode <github.com/emacs-lsp/lsp-mode>`_ and |
144 |
| -`Eglot <https://github.com/joaotavora/eglot>`_ plugins for LSP integration. |
145 |
| - |
146 |
| -Getting Involved |
147 |
| -================== |
148 |
| - |
149 |
| -A good place for interested contributors is the `Clangd developer mailing list |
150 |
| -<http://lists.llvm.org/mailman/listinfo/clangd-dev>`_. For discussions with the |
151 |
| -broader community on topics not only related to Clangd, use |
152 |
| -`Clang developer mailing list |
153 |
| -<http://lists.llvm.org/mailman/listinfo/cfe-dev>`_. |
154 |
| -If you're also interested in contributing patches to :program:`Clangd`, take a |
155 |
| -look at the `LLVM Developer Policy |
156 |
| -<http://llvm.org/docs/DeveloperPolicy.html>`_ and `Code Reviews |
157 |
| -<http://llvm.org/docs/Phabricator.html>`_ page. Contributions of new features |
158 |
| -to the `Language Server Protocol |
159 |
| -<https://github.com/Microsoft/language-server-protocol>`_ itself would also be |
160 |
| -very useful, so that :program:`Clangd` can eventually implement them in a |
161 |
| -conforming way. |
| 1 | +:orphan: |
0 commit comments