diff options
author | Sam McCall <sam.mccall@gmail.com> | 2018-06-22 16:11:35 +0000 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2018-06-22 16:11:35 +0000 |
commit | a68951e37e3df3ba19d9df0dde3bf6353e7109ad (patch) | |
tree | 9adea1297fd96e1f65256235157b0924d041e38c /clang-tools-extra/unittests/clangd/IndexTests.cpp | |
parent | 213cb1b82d3c8e311a4ea45d8c0888b9eb0008da (diff) | |
download | bcm5719-llvm-a68951e37e3df3ba19d9df0dde3bf6353e7109ad.tar.gz bcm5719-llvm-a68951e37e3df3ba19d9df0dde3bf6353e7109ad.zip |
[clangd] More precise representation of symbol names/labels in the index.
Summary:
Previously, the strings matched LSP completion pretty closely.
The completion label was a single string, for instance. This made
implementing completion itself easy but makes it hard to use the names
in other way, e.g. pretty-printed name in synthesized
documentation/hover.
It also limits our introspection into completion items, which can only
be as precise as the indexed symbols. This change is a prerequisite to
improvements to overload bundling which need to inspect e.g. signature
structure.
Reviewers: ioeric
Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits
Differential Revision: https://reviews.llvm.org/D48475
llvm-svn: 335360
Diffstat (limited to 'clang-tools-extra/unittests/clangd/IndexTests.cpp')
-rw-r--r-- | clang-tools-extra/unittests/clangd/IndexTests.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/clang-tools-extra/unittests/clangd/IndexTests.cpp b/clang-tools-extra/unittests/clangd/IndexTests.cpp index 4d7c4302741..6314268672b 100644 --- a/clang-tools-extra/unittests/clangd/IndexTests.cpp +++ b/clang-tools-extra/unittests/clangd/IndexTests.cpp @@ -274,11 +274,11 @@ TEST(MergeTest, Merge) { R.CanonicalDeclaration.FileURI = "file:///right.h"; L.References = 1; R.References = 2; - L.CompletionPlainInsertText = "f00"; // present in left only - R.CompletionSnippetInsertText = "f0{$1:0}"; // present in right only + L.Signature = "()"; // present in left only + R.CompletionSnippetSuffix = "{$1:0}"; // present in right only Symbol::Details DetL, DetR; - DetL.CompletionDetail = "DetL"; - DetR.CompletionDetail = "DetR"; + DetL.ReturnType = "DetL"; + DetR.ReturnType = "DetR"; DetR.Documentation = "--doc--"; L.Detail = &DetL; R.Detail = &DetR; @@ -288,10 +288,10 @@ TEST(MergeTest, Merge) { EXPECT_EQ(M.Name, "Foo"); EXPECT_EQ(M.CanonicalDeclaration.FileURI, "file:///left.h"); EXPECT_EQ(M.References, 3u); - EXPECT_EQ(M.CompletionPlainInsertText, "f00"); - EXPECT_EQ(M.CompletionSnippetInsertText, "f0{$1:0}"); + EXPECT_EQ(M.Signature, "()"); + EXPECT_EQ(M.CompletionSnippetSuffix, "{$1:0}"); ASSERT_TRUE(M.Detail); - EXPECT_EQ(M.Detail->CompletionDetail, "DetL"); + EXPECT_EQ(M.Detail->ReturnType, "DetL"); EXPECT_EQ(M.Detail->Documentation, "--doc--"); } @@ -302,19 +302,19 @@ TEST(MergeTest, PreferSymbolWithDefn) { L.ID = R.ID = SymbolID("hello"); L.CanonicalDeclaration.FileURI = "file:/left.h"; R.CanonicalDeclaration.FileURI = "file:/right.h"; - L.CompletionPlainInsertText = "left-insert"; - R.CompletionPlainInsertText = "right-insert"; + L.Name = "left"; + R.Name = "right"; Symbol M = mergeSymbol(L, R, &Scratch); EXPECT_EQ(M.CanonicalDeclaration.FileURI, "file:/left.h"); EXPECT_EQ(M.Definition.FileURI, ""); - EXPECT_EQ(M.CompletionPlainInsertText, "left-insert"); + EXPECT_EQ(M.Name, "left"); R.Definition.FileURI = "file:/right.cpp"; // Now right will be favored. M = mergeSymbol(L, R, &Scratch); EXPECT_EQ(M.CanonicalDeclaration.FileURI, "file:/right.h"); EXPECT_EQ(M.Definition.FileURI, "file:/right.cpp"); - EXPECT_EQ(M.CompletionPlainInsertText, "right-insert"); + EXPECT_EQ(M.Name, "right"); } } // namespace |