|
44 | 44 | #include "llvm/ADT/STLExtras.h" |
45 | 45 | #include "llvm/ADT/StringRef.h" |
46 | 46 | #include "llvm/Support/Error.h" |
47 | | -#include "llvm/Support/Format.h" |
48 | 47 | #include "llvm/Support/Path.h" |
49 | 48 | #include "llvm/Support/raw_ostream.h" |
50 | 49 | #include <algorithm> |
@@ -673,21 +672,6 @@ tryConvertToRename(const Diag *Diag, const Fix &Fix) { |
673 | 672 | return std::nullopt; |
674 | 673 | } |
675 | 674 |
|
676 | | -// Add NOLINT insert as code actions |
677 | | -std::optional<Fix> tryAddClangTidySuppression(const Diag *Diag) { |
678 | | - if (Diag->Source == Diag::ClangTidy) { |
679 | | - Fix F; |
680 | | - F.Message = llvm::formatv("ignore [{0}] for this line", Diag->Name); |
681 | | - TextEdit &E = F.Edits.emplace_back(); |
682 | | - E.newText = llvm::formatv("// NOLINTNEXTLINE({0})\n", Diag->Name); |
683 | | - Position InsertPos = Diag->Range.start; |
684 | | - InsertPos.character = 0; |
685 | | - E.range = {InsertPos, InsertPos}; |
686 | | - return F; |
687 | | - } |
688 | | - return std::nullopt; |
689 | | -} |
690 | | - |
691 | 675 | } // namespace |
692 | 676 |
|
693 | 677 | void ClangdServer::codeAction(const CodeActionInputs &Params, |
@@ -717,19 +701,14 @@ void ClangdServer::codeAction(const CodeActionInputs &Params, |
717 | 701 | return nullptr; |
718 | 702 | }; |
719 | 703 | for (const auto &DiagRef : Params.Diagnostics) { |
720 | | - if (const auto *Diag = FindMatchedDiag(DiagRef)) { |
| 704 | + if (const auto *Diag = FindMatchedDiag(DiagRef)) |
721 | 705 | for (const auto &Fix : Diag->Fixes) { |
722 | 706 | if (auto Rename = tryConvertToRename(Diag, Fix)) { |
723 | 707 | Result.Renames.emplace_back(std::move(*Rename)); |
724 | 708 | } else { |
725 | 709 | Result.QuickFixes.push_back({DiagRef, Fix}); |
726 | 710 | } |
727 | 711 | } |
728 | | - |
729 | | - if (auto Fix = tryAddClangTidySuppression(Diag)) { |
730 | | - Result.QuickFixes.push_back({DiagRef, std::move(*Fix)}); |
731 | | - } |
732 | | - } |
733 | 712 | } |
734 | 713 | } |
735 | 714 |
|
|
0 commit comments