[PATCH] D50438: [clangd] Sort GoToDefinition results.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 8 04:54:47 PDT 2018


hokein created this revision.
hokein added a reviewer: ilya-biryukov.
Herald added subscribers: arphaman, mgrang, jkorous, MaskRay, ioeric.

GoToDefinition returns all declaration results (implicit/explicit) that are
in the same location, and the results are returned in arbitrary order.

Some LSP clients defaultly take the first result as the final result, which
might present a bad result (implicit decl) to users.

this patch ranks the result based on whether the declarations are
referenced explicitly/implicitly. We put explicit declarations first.

This also improve the "hover" (which just take the first result) feature
in some cases.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D50438

Files:
  clangd/XRefs.cpp
  unittests/clangd/XRefsTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50438.159684.patch
Type: text/x-patch
Size: 9979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180808/bb82f44c/attachment.bin>


More information about the cfe-commits mailing list