[PATCH] D37101: [clangd] Add support for snippet completions

Raoul Wols via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 5 12:55:25 PDT 2017


rwols marked 7 inline comments as done.
rwols added inline comments.


================
Comment at: clangd/ClangdUnit.cpp:376
+
+    CompletionItem Item{InsertTextFormat::PlainText};
+
----------------
ilya-biryukov wrote:
> Implementations of this function in `PlainTextCompletionItemsCollector` and `SnippetCompletionItemsCollector` are the same.
> Maybe make `ProcessChunks` virtual instead?
> 
> Or maybe consider replacing inheritance with a `bool` flag. Inheritance does not seem to buy us much here. This looks simpler:
> ```
> if (EnableSnippets)
>   ProcessChunksWithSnippets(CCS, Item);
> else
>   ProcessChunksWithoutSnippets(CCS, Item);
> 
> ```
> 
> 
I went with the "make ProcessChunks virtual" approach, wouldn't your suggestion have an impact on performance? There'd be a check for every completion item now.


https://reviews.llvm.org/D37101





More information about the cfe-commits mailing list