kadircet added inline comments.

================
Comment at: clang-tools-extra/clangd/Plugin.h:26
+  virtual llvm::Optional<CodeAction>
+  actOnDiagnostic(DiagnosticsEngine::Level L, const clang::Diagnostic &Diag) {
+    return llvm::None;
----------------
i think it would be better to have these as separate modules. for example a
```
class DiagnosticsModule {
public:
virtual llvm::Optional<CodeAction>
  actOnDiagnostic(DiagnosticsEngine::Level L, const clang::Diagnostic &Diag) = 
0;
};
class HoverModule {
public:
virtual llvm::Optional<HoverInfo> generateHover(ParsedAST, Selection, 
SymbolIndex) = 0;
};
class LSPModule {
public:
virtual void registerHandler(EndPoint, Functor);
virtual json::Object dispatch(EndPoint, Params, ClangdServer&); // as some of 
these might need to mutate ClangdServer or access other modules.
};
// and so on.
```
and have multiple registries for each of these modules.

Then have a `PluginManager` in `ClangdServer` that provides a unified API for 
accessing these modules. (e.g. to implement each of our features in terms of 
these modules as discussed offline).

but I am not sure if it'll be worth the complexity with only diagnostics making 
use of that mechanism in the foreseeable future. So I am leaning towards 
keeping it simple in this version, but open for suggestions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96244/new/

https://reviews.llvm.org/D96244

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

Reply via email to