This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Report position of opening paren in singature help
ClosedPublic

Authored by ilya-biryukov on Aug 29 2018, 9:24 AM.

Diff Detail

Event Timeline

ilya-biryukov created this revision.Aug 29 2018, 9:24 AM
  • Format the code
Harbormaster completed remote builds in B22059: Diff 163116.
sammccall accepted this revision.Aug 30 2018, 1:34 AM
sammccall added inline comments.
clangd/Protocol.h
832

As noted offline, I misread this as being *inside* the paren - could maybe be more explicit?

Position of the start of the argument list, including opening paren. e.g.
foo("first arg", 
   ^argListStart ^cursor
unittests/clangd/CodeCompleteTests.cpp
914

Hmm, I think this test would be easier to follow if tests 1-5 were written separately - it's hard to spot all the locations and how the code interacts.

As a bonus, no need to mess around with explicit positions and the failure message can just echo the test:

for (const char* Test : {
  R"cpp(
    int foo(int a, b, c);
    int main() { foo(foo$p^(foo(10, 10, 10), ^); }
  )cpp",
  ...
}) {
  EXPECT_EQ(signatures(Test).argListStart, Annotations(Test).point("p")) << Test;
}
This revision is now accepted and ready to land.Aug 30 2018, 1:34 AM
ilya-biryukov marked 2 inline comments as done.
  • Clarify the docs, add example.
  • Parse each test separately.
ilya-biryukov added inline comments.Aug 30 2018, 2:21 AM
unittests/clangd/CodeCompleteTests.cpp
914

Thanks! It's way better this way!

This revision was automatically updated to reflect the committed changes.