Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the forceRebuild extension #89

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ at a particular revision.
- if unset, diagnostics will be produced for this version or some subsequent
one in a bounded amount of time.

## Force AST rebuild
{:.v11}

Clangd makes an effort to invalidate ASTs when dependent files change, but
there are some changes it does not detect, for example when an unresolved
include becomes resolved because the header file has been created.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well that isn't strictly true nowadays, we actually do track missing include directives when building a preamble and will invalidate the preamble if any of them become available.

the only scenario that I can think of for forceBuild to be useful nowadays is, when foo.h becomes available in an earlier include search path than it was found before.


If the client knows a rebuild will be necessary (e.g. because it just
generated the missing header), it can use this extension to force clangd to
do a rebuild.

**New property of `textDocument/didChange` request**: `forceRebuild: bool`
- If specified and true, clangd will rebuild the file's AST, including
for the preamble region. Warning: this is slow compared to incremental
rebuilds.

## Diagnostic categories
{:.v8}

Expand Down