[clangd] Delete deprecated enumerateTweaks endpoint

This commit is contained in:
Kadir Cetinkaya 2023-09-11 09:09:12 +02:00
parent be5b66670d
commit 26f9e49d9c
No known key found for this signature in database
GPG Key ID: E39E36B8D2057ED6
2 changed files with 0 additions and 39 deletions

View File

@ -704,38 +704,6 @@ void ClangdServer::codeAction(const CodeActionInputs &Params,
Transient);
}
void ClangdServer::enumerateTweaks(
PathRef File, Range Sel, llvm::unique_function<bool(const Tweak &)> Filter,
Callback<std::vector<TweakRef>> CB) {
auto Action = [Sel, CB = std::move(CB), Filter = std::move(Filter),
FeatureModules(this->FeatureModules)](
Expected<InputsAndAST> InpAST) mutable {
if (!InpAST)
return CB(InpAST.takeError());
auto Selections = tweakSelection(Sel, *InpAST, /*FS=*/nullptr);
if (!Selections)
return CB(Selections.takeError());
std::vector<TweakRef> Res;
// Don't allow a tweak to fire more than once across ambiguous selections.
llvm::DenseSet<llvm::StringRef> PreparedTweaks;
auto DeduplicatingFilter = [&](const Tweak &T) {
return Filter(T) && !PreparedTweaks.count(T.id());
};
for (const auto &Sel : *Selections) {
for (auto &T : prepareTweaks(*Sel, DeduplicatingFilter, FeatureModules)) {
Res.push_back({T->id(), T->title(), T->kind()});
PreparedTweaks.insert(T->id());
TweakAvailable.record(1, T->id());
}
}
CB(std::move(Res));
};
WorkScheduler->runWithAST("EnumerateTweaks", File, std::move(Action),
Transient);
}
void ClangdServer::applyTweak(PathRef File, Range Sel, StringRef TweakID,
Callback<Tweak::Effect> CB) {
// Tracks number of times a tweak has been attempted.

View File

@ -386,13 +386,6 @@ public:
void codeAction(const CodeActionInputs &Inputs,
Callback<CodeActionResult> CB);
/// Enumerate the code tweaks available to the user at a specified point.
/// Tweaks where Filter returns false will not be checked or included.
/// Deprecated, use codeAction instead.
void enumerateTweaks(PathRef File, Range Sel,
llvm::unique_function<bool(const Tweak &)> Filter,
Callback<std::vector<TweakRef>> CB);
/// Apply the code tweak with a specified \p ID.
void applyTweak(PathRef File, Range Sel, StringRef ID,
Callback<Tweak::Effect> CB);