ClangCodeModel: Request clangd quickfix for -Wswitch warning

This way, a warning about missing switch cases will be accompanied by a
matching code action, which allows the user to fix it right away by
clicking on the lightbulb.
Requires clangd >= 15; see https://reviews.llvm.org/D118976.

Change-Id: I11e82264c41e4154f979d28a5e44e72c8158595b
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-02-04 10:59:11 +01:00
parent 531e24892b
commit 15280d7127
3 changed files with 37 additions and 6 deletions

View File

@@ -168,6 +168,8 @@ public:
void updateConfiguration(const QJsonValue &configuration);
// commands
void requestCodeActions(const LanguageServerProtocol::DocumentUri &uri,
const LanguageServerProtocol::Diagnostic &diagnostic);
void requestCodeActions(const LanguageServerProtocol::DocumentUri &uri,
const QList<LanguageServerProtocol::Diagnostic> &diagnostics);
void requestCodeActions(const LanguageServerProtocol::CodeActionRequest &request);
@@ -253,6 +255,9 @@ private:
void requestDocumentHighlightsNow(TextEditor::TextEditorWidget *widget);
LanguageServerProtocol::SemanticRequestTypes supportedSemanticRequests(TextEditor::TextDocument *document) const;
void handleSemanticTokens(const LanguageServerProtocol::SemanticTokens &tokens);
void requestCodeActions(const LanguageServerProtocol::DocumentUri &uri,
const LanguageServerProtocol::Range &range,
const QList<LanguageServerProtocol::Diagnostic> &diagnostics);
void documentClosed(Core::IDocument *document);
virtual void handleDocumentClosed(TextEditor::TextDocument *) {}