[PATCH] D38425: [clangd] Document highlights for clangd

Marc-Andre Laperle via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 24 10:05:38 PST 2017


malaperle requested changes to this revision.
malaperle added inline comments.
This revision now requires changes to proceed.


================
Comment at: clangd/ClangdLSPServer.cpp:242
+
+  auto Items = Server
+                   .findDocumentHighlights(Params.textDocument.uri.file,
----------------
malaperle wrote:
> Items -> Highlights?
Items -> Highlights?


================
Comment at: clangd/ClangdServer.h:291
+  /// Get document highlights for a symbol hovered on.
+  Tagged<std::vector<DocumentHighlight>> findDocumentHighlights(PathRef File,
+                                                                Position Pos);
----------------
Nebiroth wrote:
> malaperle wrote:
> > can this thing fail? Should it be Expected<Tagged... ??
> Oops, yeah this should be a llvm::Expected
can this thing fail? Should it be Expected<Tagged... ??


================
Comment at: clangd/ClangdUnit.cpp:956
+    Decls.erase(Last, Decls.end());
+    return Decls;
+  }
----------------
std::move


================
Comment at: clangd/ClangdUnit.cpp:965
+    MacroInfos.erase(Last, MacroInfos.end());
+    return MacroInfos;
   }
----------------
std::move


================
Comment at: clangd/ClangdUnit.cpp:1017
+  std::vector<const Decl *> &Decls;
+  std::vector<DocumentHighlightKind> Kinds;
+  std::vector<SourceRange> SourceRanges;
----------------
remove


================
Comment at: clangd/ClangdUnit.cpp:1018
+  std::vector<DocumentHighlightKind> Kinds;
+  std::vector<SourceRange> SourceRanges;
+  std::vector<DocumentHighlight> DocumentHighlights;
----------------
remove


================
Comment at: clangd/ClangdUnit.cpp:1028
+
+  std::vector<const Decl *> takeDecls() {
+    // Don't keep the same declaration multiple times.
----------------
remove


================
Comment at: clangd/ClangdUnit.cpp:1037
+
+  std::vector<SourceRange> takeSourceRanges() { return SourceRanges; }
+
----------------
remove


================
Comment at: clangd/ClangdUnit.cpp:1039
+
+  std::vector<DocumentHighlightKind> takeKinds() { return Kinds; }
+
----------------
remove


================
Comment at: clangd/ClangdUnit.cpp:1079
+
+  DocumentHighlight addDocumentHighlight(SourceRange SR,
+                                         DocumentHighlightKind Kind) {
----------------
either this should be named getDocumentHighlight or it should do the push back and return void


https://reviews.llvm.org/D38425





More information about the cfe-commits mailing list