1 //===--- CodeCompletionStrings.h ---------------------------------*- C++-*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===---------------------------------------------------------------------===// 9 // 10 // Functions for retrieving code completion information from 11 // `CodeCompletionString`. 12 // 13 //===---------------------------------------------------------------------===// 14 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_CODECOMPLETIONSTRINGS_H 15 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CODECOMPLETIONSTRINGS_H 16 17 #include "clang/Sema/CodeCompleteConsumer.h" 18 19 namespace clang { 20 namespace clangd { 21 22 /// Gets label and insert text for a completion item. For example, for function 23 /// `Foo`, this returns <"Foo(int x, int y)", "Foo"> without snippts enabled. 24 /// 25 /// If \p EnableSnippets is true, this will try to use snippet for the insert 26 /// text. Otherwise, the insert text will always be plain text. 27 void getLabelAndInsertText(const CodeCompletionString &CCS, std::string *Label, 28 std::string *InsertText, bool EnableSnippets); 29 30 /// Gets the documentation for a completion item. For example, comment for the 31 /// a class declaration. 32 std::string getDocumentation(const CodeCompletionString &CCS); 33 34 /// Gets detail to be used as the detail field in an LSP completion item. This 35 /// is usually the return type of a function. 36 std::string getDetail(const CodeCompletionString &CCS); 37 38 /// Gets the piece of text that the user is expected to type to match the 39 /// code-completion string, typically a keyword or the name of a declarator or 40 /// macro. 41 std::string getFilterText(const CodeCompletionString &CCS); 42 43 } // namespace clangd 44 } // namespace clang 45 46 #endif 47