Author: ibiryukov Date: Tue Mar 6 08:45:21 2018 New Revision: 326809 URL: http://llvm.org/viewvc/llvm-project?rev=326809&view=rev Log: [clangd] Don't end completion item labels with '::'
Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp clang-tools-extra/trunk/test/clangd/protocol.test clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=326809&r1=326808&r2=326809&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original) +++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Tue Mar 6 08:45:21 2018 @@ -470,6 +470,8 @@ struct CompletionRecorder : public CodeC // (s.^ completes ~string, but s.~st^ is an error). if (dyn_cast_or_null<CXXDestructorDecl>(Result.Declaration)) continue; + // We choose to never append '::' to completion results in clangd. + Result.StartsNestedNameSpecifier = false; Results.push_back(Result); } ResultsCallback(); Modified: clang-tools-extra/trunk/test/clangd/protocol.test URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clangd/protocol.test?rev=326809&r1=326808&r2=326809&view=diff ============================================================================== --- clang-tools-extra/trunk/test/clangd/protocol.test (original) +++ clang-tools-extra/trunk/test/clangd/protocol.test Tue Mar 6 08:45:21 2018 @@ -38,7 +38,7 @@ Content-Length: 146 # CHECK-NEXT: "insertText": "fake", # CHECK-NEXT: "insertTextFormat": 1, # CHECK-NEXT: "kind": 7, -# CHECK-NEXT: "label": "fake::", +# CHECK-NEXT: "label": "fake", # CHECK-NEXT: "sortText": "{{.*}}" # CHECK: ] # CHECK-NEXT: } @@ -67,7 +67,7 @@ Content-Length: 146 # CHECK-NEXT: "insertText": "fake", # CHECK-NEXT: "insertTextFormat": 1, # CHECK-NEXT: "kind": 7, -# CHECK-NEXT: "label": "fake::", +# CHECK-NEXT: "label": "fake", # CHECK-NEXT: "sortText": "{{.*}}" # CHECK: ] # CHECK-NEXT: } @@ -96,7 +96,7 @@ Content-Length: 146 # CHECK-NEXT: "insertText": "fake", # CHECK-NEXT: "insertTextFormat": 1, # CHECK-NEXT: "kind": 7, -# CHECK-NEXT: "label": "fake::", +# CHECK-NEXT: "label": "fake", # CHECK-NEXT: "sortText": "{{.*}}" # CHECK: ] # CHECK-NEXT: } Modified: clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp?rev=326809&r1=326808&r2=326809&view=diff ============================================================================== --- clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp (original) +++ clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp Tue Mar 6 08:45:21 2018 @@ -595,6 +595,18 @@ TEST(CodeCompleteTest, DisableTypoCorrec EXPECT_TRUE(Results.items.empty()); } +TEST(CodeCompleteTest, NoColonColonAtTheEnd) { + auto Results = completions(R"cpp( + namespace clang { } + void f() { + clan^ + } + )cpp"); + + EXPECT_THAT(Results.items, Contains(Labeled("clang"))); + EXPECT_THAT(Results.items, Not(Contains(Labeled("clang::")))); +} + SignatureHelp signatures(StringRef Text) { MockFSProvider FS; MockCompilationDatabase CDB; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits