diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -513,7 +513,8 @@ if (Snippet->empty()) return ""; if (Completion.Kind == CompletionItemKind::Function || - Completion.Kind == CompletionItemKind::Method) { + Completion.Kind == CompletionItemKind::Method || + Completion.Kind == CompletionItemKind::Text /*Macro*/) { // Functions snippets can be of 2 types: // - containing only function arguments, e.g. // foo(${1:int p1}, ${2:int p2}); diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp --- a/clang-tools-extra/clangd/tool/ClangdMain.cpp +++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp @@ -233,7 +233,6 @@ "function calls. When enabled, completions also contain " "placeholders for method parameters"), init(CodeCompleteOptions().EnableFunctionArgSnippets), - Hidden, }; opt HeaderInsertion{ diff --git a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp --- a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp +++ b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp @@ -2318,6 +2318,15 @@ UnorderedElementsAre(AllOf(Named("foo_class"), SnippetSuffix("<$0>")), AllOf(Named("foo_alias"), SnippetSuffix("<$0>")))); } + { + auto Results = completions( + R"cpp( + #define FOO(x, y) x##f + FO^ )cpp", + {}, Opts); + EXPECT_THAT(Results.Completions, UnorderedElementsAre(AllOf( + Named("FOO"), SnippetSuffix("($0)")))); + } } TEST(CompletionTest, SuggestOverrides) {