[PATCH] D96245: [clangd] Propagate CodeActions in addition to Fixes for diagnostics
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 8 02:54:01 PST 2021
kadircet added a comment.
> Emitting fixes for a diagnostic in another file seems dangerous, what's the intended use case for this?
one particular example is fixing layering violations in more strict build systems like bazel/blaze. for example if you `#include "a.h"` in a file, but build target of that particular file doesn't depend on a target exporting `a.h` clangd can generate an edit to update the relevant build target to have a dependency on `a.h`.
================
Comment at: clang-tools-extra/clangd/Diagnostics.h:113
+ const ClangdDiagnosticOptions &Opts,
+ llvm::function_ref<void(clangd::Diagnostic, llvm::ArrayRef<Fix>,
+ llvm::ArrayRef<CodeAction>)>
----------------
we keep broadcasting fixes and actions separately to keep embedders that can't handle codeactions happy.
we can start emitting just codeactions here by converting fixes to codeactions in this layer (all we need is fileuri, and we have it). then embedders can still iterate over all code actions and pick only the edits for mainfile while ignoring the rest.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96245/new/
https://reviews.llvm.org/D96245
More information about the cfe-commits
mailing list