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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to