diff options
| author | Sam McCall <sam.mccall@gmail.com> | 2018-07-02 11:13:16 +0000 |
|---|---|---|
| committer | Sam McCall <sam.mccall@gmail.com> | 2018-07-02 11:13:16 +0000 |
| commit | e746a2b4f7dbe0c6b8dd280a92ddfb1644b232f9 (patch) | |
| tree | 22e2edcfb2a00ed68dce407a698c25dbd7389b69 /clang-tools-extra/clangd/CodeComplete.h | |
| parent | 2757df7933766a8ec344cb51eebfaa554812c685 (diff) | |
| download | bcm5719-llvm-e746a2b4f7dbe0c6b8dd280a92ddfb1644b232f9.tar.gz bcm5719-llvm-e746a2b4f7dbe0c6b8dd280a92ddfb1644b232f9.zip | |
[clangd] ClangdServer::codeComplete return CodeCompleteResult, not LSP struct.
Summary:
This provides more structured information that embedders can use for rendering.
ClangdLSPServer continues to call render(), so NFC.
The patch is:
- trivial changes to ClangdServer/ClangdLSPServer
- mostly-mechanical updates to CodeCompleteTests etc for the new API
- new direct tests of render() in CodeCompleteTests
- tiny cleanups to CodeCompletionItem (operator<< and missing initializers)
Reviewers: ioeric
Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits
Differential Revision: https://reviews.llvm.org/D48821
llvm-svn: 336094
Diffstat (limited to 'clang-tools-extra/clangd/CodeComplete.h')
| -rw-r--r-- | clang-tools-extra/clangd/CodeComplete.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/CodeComplete.h b/clang-tools-extra/clangd/CodeComplete.h index 78a78b82047..3e37bf418be 100644 --- a/clang-tools-extra/clangd/CodeComplete.h +++ b/clang-tools-extra/clangd/CodeComplete.h @@ -102,7 +102,7 @@ struct CodeCompletion { // - ReturnType may be empty // - Documentation may be from one symbol, or a combination of several // Other fields should apply equally to all bundled completions. - unsigned BundleSize; + unsigned BundleSize = 1; // The header through which this symbol could be included. // Quoted string as expected by an #include directive, e.g. "<memory>". // Empty for non-symbol completions, or when not known. @@ -136,10 +136,12 @@ struct CodeCompletion { // Serialize this to an LSP completion item. This is a lossy operation. CompletionItem render(const CodeCompleteOptions &) const; }; +raw_ostream &operator<<(raw_ostream &, const CodeCompletion &); struct CodeCompleteResult { std::vector<CodeCompletion> Completions; bool HasMore = false; }; +raw_ostream &operator<<(raw_ostream &, const CodeCompleteResult &); /// Get code completions at a specified \p Pos in \p FileName. CodeCompleteResult codeComplete( |

