diff options
author | Eric Liu <ioeric@google.com> | 2018-10-17 11:19:02 +0000 |
---|---|---|
committer | Eric Liu <ioeric@google.com> | 2018-10-17 11:19:02 +0000 |
commit | 3fac4ef1fdb4e6b2b4743f33498612c233da325d (patch) | |
tree | f3dbf1cda024228cff98f9e00d8dbd50188144e6 /clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp | |
parent | e2566b5d877c415f128a9f3d75ef2173bf32c347 (diff) | |
download | bcm5719-llvm-3fac4ef1fdb4e6b2b4743f33498612c233da325d.tar.gz bcm5719-llvm-3fac4ef1fdb4e6b2b4743f33498612c233da325d.zip |
[clangd] Support scope proximity in code completion.
Summary:
This should make all-scope completion more usable. Scope proximity for
indexes will be added in followup patch.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D53131
llvm-svn: 344688
Diffstat (limited to 'clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp')
-rw-r--r-- | clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp b/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp index e056699ab55..c0e59e800db 100644 --- a/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp +++ b/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp @@ -1040,6 +1040,28 @@ TEST(CompletionTest, UnqualifiedIdQuery) { UnorderedElementsAre("", "ns::", "std::")))); } +TEST(CompletionTest, EnclosingScopeComesFirst) { + auto Requests = captureIndexRequests(R"cpp( + namespace std {} + using namespace std; + namespace nx { + namespace ns { + namespace { + void f() { + vec^ + } + } + } + } + )cpp"); + + EXPECT_THAT(Requests, + ElementsAre(Field( + &FuzzyFindRequest::Scopes, + UnorderedElementsAre("", "std::", "nx::ns::", "nx::")))); + EXPECT_EQ(Requests[0].Scopes[0], "nx::ns::"); +} + TEST(CompletionTest, ResolvedQualifiedIdQuery) { auto Requests = captureIndexRequests(R"cpp( namespace ns1 {} |