[PATCH] D54799: [clangd][WIP] textDocument/CursorInfo method

Jan Korous via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 21 07:24:01 PST 2018


jkorous created this revision.
jkorous added reviewers: sammccall, arphaman, benlangmuir.
Herald added subscribers: cfe-commits, kadircet, dexonsmith, MaskRay, ioeric, ilya-biryukov.

Hi,

I implemented `textDocument/cursorInfo` method based on consensus in https://reviews.llvm.org/D54529.
I'd like to ask for early feedback - what's still missing is relevant client capability.

Couple things that I'd love to hear opinions about are:

- conditional return in `getCursorInfo` - Should we return for example data with empty `USR`?
- `containerName` of local variables - It's currently empty even if semantic parent has a name (say it's a function). (Please search for local.cpp in the test.) Is that what we want?
- For now I used `getSymbolAtPosition()` as it's simpler and fits the context better. However I assume I could use this optimization from `tooling::getNamedDeclAt()` (in a separate patch): https://github.com/llvm-mirror/clang/blob/master/lib/Tooling/Refactoring/Rename/USRFinder.cpp#L82
- One thing I am wondering about is whether we could use (and whether it's a significant improvement) some early return in `indexTopLevelDecls` (using `DeclarationAndMacrosFinder`) also for hover and definition use-cases. Is it correct to assume that at a given `Location` there can be maximum of one declaration and one definition?

P. S. Alex and Ben have thanksgiving break now so they'll probably add any feedback next week.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54799

Files:
  ClangdLSPServer.cpp
  ClangdLSPServer.h
  ClangdServer.cpp
  ClangdServer.h
  Protocol.cpp
  Protocol.h
  XRefs.cpp
  XRefs.h
  clangd/cursor-info.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54799.174926.patch
Type: text/x-patch
Size: 11589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181121/2bc2d76b/attachment-0001.bin>


More information about the cfe-commits mailing list