@@ -47,6 +47,9 @@ Major New Features
47
47
Improvements to clangd
48
48
----------------------
49
49
50
+ Performance
51
+ ^^^^^^^^^^^
52
+
50
53
- clangd's memory usage is significantly reduced on most Linux systems.
51
54
In particular, memory usage should not increase dramatically over time.
52
55
@@ -59,6 +62,172 @@ Improvements to clangd
59
62
systems can disable this using ``--malloc_trim=0 `` or the CMake flag
60
63
``-DCLANGD_MALLOC_TRIM=0 ``.
61
64
65
+ - Added the `$/memoryUsage request
66
+ <https://clangd.llvm.org/extensions.html#memory-usage> `_: an LSP extension.
67
+ This provides a breakdown of the memory clangd thinks it is using (excluding
68
+ malloc overhead etc). The clangd VSCode extension supports showing the memory
69
+ usage tree.
70
+
71
+ Parsing and selection
72
+ ^^^^^^^^^^^^^^^^^^^^^
73
+
74
+ - Improved navigation of broken code in C using Recovery AST. (This has been
75
+ enabled for C++ since clangd 11).
76
+
77
+ - Types are understood more often in broken code. (This is the first release
78
+ where Recovery AST preserves speculated types).
79
+
80
+ - Heuristic resolution for dependent names in templates.
81
+
82
+ Code completion
83
+ ^^^^^^^^^^^^^^^
84
+
85
+ - Higher priority for symbols that were already used in this file, and symbols
86
+ from namespaces mentioned in this file. (Estimated 3% accuracy improvement)
87
+
88
+ - Introduced a ranking algorithm trained on snippets from a large C++ codebase.
89
+ Use the flag ``--ranking-model=decision_forest `` to try this (Estimated 6%
90
+ accuracy improvement). This mode is likely to become the default in future.
91
+
92
+ Note: this is a generic model, not specialized for your code. clangd does not
93
+ collect any data from your code to train code completion.
94
+
95
+ - Signature help works with functions with template-dependent parameter types.
96
+
97
+ Go to definition
98
+ ^^^^^^^^^^^^^^^^
99
+
100
+ - Selecting an ``auto `` or ``decltype `` keyword will attempt to navigate to
101
+ a definition of the deduced type.
102
+
103
+ - Improved handling of aliases: navigate to the underlying entity more often.
104
+
105
+ - Better understanding of declaration vs definition for Objective-C classes and
106
+ protocols.
107
+
108
+ - Selecting a pure-virtual method shows its overrides.
109
+
110
+ Find references
111
+ ^^^^^^^^^^^^^^^
112
+
113
+ - Indexes are smarter about not returning stale references when code is deleted.
114
+
115
+ - References in implementation files are always indexed, so results should be
116
+ more complete.
117
+
118
+ - Find-references on a virtual method shows references to overridden methods.
119
+
120
+ New navigation features
121
+ ^^^^^^^^^^^^^^^^^^^^^^^
122
+
123
+ - Call hierarchy (``textDocument/callHierarchy ``) is supported.
124
+ Only incoming calls are available.
125
+
126
+ - Go to implementation (``textDocument/implementation ``) is supported on
127
+ abstract classes, and on virtual methods.
128
+
129
+ - Symbol search (``workspace/symbol ``) queries may be partially qualified.
130
+ That is, typing ``b::Foo `` will match the symbol ``a::b::c::Foo ``.
131
+
132
+ Refactoring
133
+ ^^^^^^^^^^^
134
+
135
+ - New refactoring: populate ``switch `` statement with cases.
136
+ (This acts as a fix for the ``-Wswitch-enum `` warning).
137
+
138
+ - Renaming templates is supported, and many other complex cases were fixed.
139
+
140
+ - Attempting to rename to an invalid or conflicting name can produce an error
141
+ message rather than broken code. (Not all cases are detected!)
142
+
143
+ - The accuracy of many code actions has been improved.
144
+
145
+ Hover
146
+ ^^^^^
147
+
148
+ - Hovers for ``auto `` and ``decltype `` show the type in the same style as other
149
+ hovers. ``this `` is also now supported.
150
+
151
+ - Displayed type names are more consistent and idiomatic.
152
+
153
+ Semantic highlighting
154
+ ^^^^^^^^^^^^^^^^^^^^^
155
+
156
+ - Inactive preprocessor regions (``#ifdef ``) are highlighted as comments.
157
+
158
+ - clangd 12 is the last release with support for the non-standard
159
+ ``textDocument/semanticHighlights `` notification. Clients sholud migrate to
160
+ the ``textDocument/semanticTokens `` request added in LSP 3.16.
161
+
162
+ Remote index (alpha)
163
+ ^^^^^^^^^^^^^^^^^^^^
164
+
165
+ - clangd can now connect to a remote index server instead of building a project
166
+ index locally. This saves resources in large codebases that are slow to index.
167
+
168
+ - The server program is ``clangd-index-server ``, and it consumes index files
169
+ produced by ``clangd-indexer ``.
170
+
171
+ - This feature requires clangd to be built with the CMake flag
172
+ ``-DCLANGD_ENABLE_REMOTE=On ``, which requires GRPC libraries and is not
173
+ enabled by default. Unofficial releases of the remote-index-enabled client
174
+ and server tools are at https://github.com/clangd/clangd/releases
175
+
176
+ - Large projects can deploy a shared server, and check in a ``.clangd `` file
177
+ to enable it (in the ``Index.External `` section). We hope to provide such a
178
+ server for ``llvm-project `` itself in the near future.
179
+
180
+ Configuration
181
+ ^^^^^^^^^^^^^
182
+
183
+ - Static and remote indexes can be configured in the ``Index.External `` section.
184
+ Different static indexes can now be used for different files.
185
+ (Obsoletes the flag ``--index-file ``).
186
+
187
+ - Diagnostics can be filtered or suppressed in the ``Diagnostics `` section.
188
+
189
+ - Clang-tidy checks can be enabled/disabled in the ``Diagnostics.ClangTidy ``
190
+ section. (Obsoletes the flag ``--clang-tidy-checks ``).
191
+
192
+ - The compilation database directory can be configured in the ``CompileFlags ``
193
+ section. Different compilation databases can now be specified for different
194
+ files. (Obsoletes the flag ``--compile-commands-dir ``).
195
+
196
+ - Errors in loaded configuration files are published as LSP diagnostics, and so
197
+ should be shown in your editor.
198
+
199
+ `Full reference of configuration options <https://clangd.llvm.org/config.html >`_
200
+
201
+ System integration
202
+ ^^^^^^^^^^^^^^^^^^
203
+
204
+ - Changes to ``compile_commands.json `` and ``compile_flags.txt `` will take
205
+ effect the next time a file is parsed, without restarting clangd.
206
+
207
+ - ``clangd --check=<filename> `` can be run on the command-line to simulate
208
+ opening a file without actually using an editor. This can be useful to
209
+ reproduce crashes or aother problems.
210
+
211
+ - Various fixes to handle filenames correctly (and case-insensitively) on
212
+ windows.
213
+
214
+ - If incoming LSP messages are malformed, the logs now contain details.
215
+
216
+ Miscellaneous
217
+ ^^^^^^^^^^^^^
218
+
219
+ - "Show AST" request
220
+ (`textDocument/ast <https://clangd.llvm.org/extensions.html#ast >`_)
221
+ added as an LSP extension. This displays a simplified view of the clang AST
222
+ for selected code. The clangd VSCode extension supports this.
223
+
224
+ - clangd should no longer crash while loading old or corrupt index files.
225
+
226
+ - The flags ``--index ``, ``--recovery-ast `` and ``-suggest-missing-includes ``
227
+ have been retired. These features are now always enabled.
228
+
229
+ - Too many stability and correctness fixes to mention.
230
+
62
231
Improvements to clang-doc
63
232
-------------------------
64
233
0 commit comments