sammccall added inline comments.

================
Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:1194-1201
   if (Params.positions.size() != 1) {
     elog("{0} positions provided to SelectionRange. Supports exactly one "
          "position.",
          Params.positions.size());
     return Reply(llvm::make_error<LSPError>(
         "SelectionRange supports exactly one position",
         ErrorCode::InvalidRequest));
----------------
usaxena95 wrote:
> You can remove this check now.
Oops!


================
Comment at: clang-tools-extra/clangd/SemanticSelection.cpp:74
+  SelectionRange *Tail = &Head;
+  for (auto &Range : llvm::makeArrayRef(Ranges).drop_front()) {
+    Tail->parent = std::make_unique<SelectionRange>();
----------------
usaxena95 wrote:
> nit:`Range` can be made a `const` ref.
Oops, fixed to actually move.


================
Comment at: clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp:175
 
-  auto Ranges = runSemanticRanges(Server, FooCpp, SourceAnnotations.point());
+  auto Ranges = runSemanticRanges(Server, FooCpp, SourceAnnotations.points());
   ASSERT_TRUE(bool(Ranges))
----------------
usaxena95 wrote:
> I think it would be better to name the two points in the test and explicitly 
> specify their order in the request (instead of relying on 
> `SourceAnnotations.points()`). 
> Annotations::points doesn't guarantee order in its contract. Even if the 
> current implementation does, it would be better to be explicit and not rely 
> on it.
Good point. I updated the documentation on Annotations instead to make this 
guarantee, this was always the intent.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76741



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

Reply via email to