clang-tools 20.0.0git
|
Clangd may wait after an update to see if another one comes along. More...
#include <TUScheduler.h>
Public Types | |
using | clock = std::chrono::steady_clock |
Public Member Functions | |
clock::duration | compute (llvm::ArrayRef< clock::duration > History) const |
Compute the time to debounce based on this policy and recent build times. | |
Static Public Member Functions | |
static DebouncePolicy | fixed (clock::duration) |
A policy that always returns the same duration, useful for tests. | |
Public Attributes | |
clock::duration | Min = {} |
The minimum time that we always debounce for. | |
clock::duration | Max = {} |
The maximum time we may debounce for. | |
float | RebuildRatio = 1 |
Target debounce, as a fraction of file rebuild time. | |
Clangd may wait after an update to see if another one comes along.
This is so we rebuild once the user stops typing, not when they start. Debounce may be disabled/interrupted if we must build this version. The debounce time is responsive to user preferences and rebuild time. In the future, we could also consider different types of edits.
Definition at line 74 of file TUScheduler.h.
using clang::clangd::DebouncePolicy::clock = std::chrono::steady_clock |
Definition at line 75 of file TUScheduler.h.
DebouncePolicy::clock::duration clang::clangd::DebouncePolicy::compute | ( | llvm::ArrayRef< clock::duration > | History | ) | const |
Compute the time to debounce based on this policy and recent build times.
Definition at line 1833 of file TUScheduler.cpp.
References Max, Min, and RebuildRatio.
|
static |
A policy that always returns the same duration, useful for tests.
Definition at line 1854 of file TUScheduler.cpp.
Referenced by clang::clangd::ClangdServer::optsForTest().
clock::duration clang::clangd::DebouncePolicy::Max = {} |
The maximum time we may debounce for.
Definition at line 80 of file TUScheduler.h.
clock::duration clang::clangd::DebouncePolicy::Min = {} |
The minimum time that we always debounce for.
Definition at line 78 of file TUScheduler.h.
float clang::clangd::DebouncePolicy::RebuildRatio = 1 |
Target debounce, as a fraction of file rebuild time.
e.g. RebuildRatio = 2, recent builds took 200ms => debounce for 400ms.
Definition at line 83 of file TUScheduler.h.
Referenced by compute().