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

2017-09-02 Thread Raoul Wols via Phabricator via cfe-commits
rwols updated this revision to Diff 113657. rwols added a comment. - Adjust SnippetCompletionItemCollector such that it only sets insertTextFormat to InsertTextFormat::Snippet when it's actually needed (i.e. we encounter a CK_Placeholder chunk). - Fix failing tests in test/clangd/{completion.tes

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

2017-09-02 Thread Raoul Wols via Phabricator via cfe-commits
rwols marked 4 inline comments as done. rwols added inline comments. Comment at: clangd/ClangdUnit.cpp:419 +assert(item.detail.empty() && "Unexpected extraneous CK_ResultType"); +Item.detail = Chunk.Text; +break; ilya-biryukov wrote: > Won

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

2017-09-02 Thread Raoul Wols via Phabricator via cfe-commits
rwols added a comment. Forgot to mention I've also made sure the `filterText` field is taken care of now (both for snippet and for plaintext items). https://reviews.llvm.org/D37101 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://list

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

2017-09-02 Thread Raoul Wols via Phabricator via cfe-commits
rwols updated this revision to Diff 113650. rwols marked 3 inline comments as done. rwols added a comment. - Split up the CompletionItemsCollector into two classes called PlainTextCompletionItemsCollector and SnippetCompletionItemsCollector to allow collecting both types of items. - Add a comman

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

2017-09-01 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdUnit.cpp:337 +// Fill in the kind field of the CompletionItem. +Item.kind = getKind(Result.CursorKind); + ilya-biryukov wrote: > ilya-biryukov wrote: > > Could we also set `Item.filterText` to

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

2017-09-01 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdUnit.cpp:337 +// Fill in the kind field of the CompletionItem. +Item.kind = getKind(Result.CursorKind); + ilya-biryukov wrote: > Could we also set `Item.filterText` to completion item name? > S

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

2017-09-01 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdUnit.cpp:418 +// for functions and methods, the return type. +assert(item.detail.empty() && "Unexpected extraneous CK_ResultType"); +Item.detail = Chunk.Text; Typo: should be `I

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

2017-09-01 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Also wanted to stress once again that we need some tests for this change. https://reviews.llvm.org/D37101 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

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

2017-09-01 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. This looks like a useful change even without prior changes to VSCode. Maybe add a command-line flag to clangd(`--enable-snippets`) and commit that? When snippets are disabled, we could simply do `insertText = /**/` after `ProcessChunks`, we will deprecate and remo

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

2017-08-30 Thread Raoul Wols via Phabricator via cfe-commits
rwols updated this revision to Diff 113258. rwols added a comment. Some more tweaks - Move assert to constructor of CompletionItemsCollector - Use a local variable for the annotations count - Move the documentation handling to its own private const member function https://reviews.llvm.org/D3710

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

2017-08-30 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added inline comments. Comment at: clangd/ClangdUnit.cpp:302 unsigned NumResults) override { -for (unsigned I = 0; I != NumResults; ++I) { - CodeCompletionResult &Result = Results[I]; - CodeCompletionString *CCS = Result.C

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

2017-08-30 Thread Raoul Wols via Phabricator via cfe-commits
rwols added a comment. So at this point the C++ changes are basically done, save for some minor things I guess. The problem is still that the VSCode extension doesn't do anything clever with the snippets. I have zero experience with TypeScript let alone extension development for VSCode, so it c

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

2017-08-30 Thread Raoul Wols via Phabricator via cfe-commits
rwols marked 10 inline comments as done. rwols added a comment. I followed your advice and kept the snippet functionality. We'll do the SignatureHelp stuff in another review. A "major" change is that, because CK_Informative chunks are put into the label now, we have to use the insertText, alway

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

2017-08-30 Thread Raoul Wols via Phabricator via cfe-commits
rwols updated this revision to Diff 113219. rwols added a comment. Tidy up snippet handling - Put CK_Informative chunks in the label - Assert that there's at most one CK_ResultType chunk - CK_CurrentParameter never occurs while collecting completions, only while handling overloads. - For CK_Vert

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

2017-08-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdUnit.cpp:321 + +// Fill in the label, detail, documentation and insertText fields of the +// CompletionItem. rwols wrote: > ilya-biryukov wrote: > > Maybe split writes into `Item.label` and oth

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

2017-08-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. In https://reviews.llvm.org/D37101#853509, @rwols wrote: > After digging into VSCode, I now think that presenting snippets is the wrong > way forward, and I believe the right way is to implement the > `signatureHelpProvider` protocol for method/function parameters

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

2017-08-27 Thread Raoul Wols via Phabricator via cfe-commits
rwols added a comment. After digging into VSCode, I now think that presenting snippets is the wrong way forward, and I believe the right way is to implement the `signatureHelpProvider` protocol for method/function parameters. See: https://github.com/Microsoft/vscode-docs/blob/master/docs/extens

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

2017-08-24 Thread Raoul Wols via Phabricator via cfe-commits
rwols marked 10 inline comments as done. rwols added inline comments. Comment at: clangd/ClangdUnit.cpp:321 + +// Fill in the label, detail, documentation and insertText fields of the +// CompletionItem. ilya-biryukov wrote: > Maybe split writes into `Ite

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

2017-08-24 Thread Raoul Wols via Phabricator via cfe-commits
rwols updated this revision to Diff 112609. rwols added a comment. [clangd] [WIP] Add support for snippet completions - Restore the sortText logic - Return CompletionItem instead of modifying a ref param - Make all helper methods const - Only set to Snippet once we encounter CK_Placeholder/CK_Cur

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

2017-08-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. In https://reviews.llvm.org/D37101#851380, @rwols wrote: > Thanks for the quick review! I'm new to Phabricator and the `arc` CLI tool. > Is the workflow like this: "address a comment, change a few lines, do `arc > diff`, do this multiple times", or is it like this

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

2017-08-24 Thread Raoul Wols via Phabricator via cfe-commits
rwols added a comment. Thanks for the quick review! I'm new to Phabricator and the `arc` CLI tool. Is the workflow like this: "address a comment, change a few lines, do `arc diff`, do this multiple times", or is it like this: "address all the comments, change lots of lines, do `arc diff`, do th

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

2017-08-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov requested changes to this revision. ilya-biryukov added a comment. This revision now requires changes to proceed. Thanks for taking your time to implement this! We need to add some test cases for new completion features. However, adding them may be a bit of a pain, so feel free to

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

2017-08-24 Thread Raoul Wols via Phabricator via cfe-commits
rwols created this revision. Enhances CompletionItemsCollector in such a way that snippet completions are presented to the client. This is a work-in-progress. It currently works in Sublime Text 3 using the new "LSP" plugin. In VSCode, the snippets are inserted into the buffer as plaintext without