mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 05:40:09 +00:00
[clangd] Delete deprecated enumerateTweaks endpoint
This commit is contained in:
parent
be5b66670d
commit
26f9e49d9c
@ -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.
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user