[clangd] Place cursor better after completing patterns
authorIlya Biryukov <ibiryukov@google.com>
Tue, 28 May 2019 15:33:37 +0000 (15:33 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Tue, 28 May 2019 15:33:37 +0000 (15:33 +0000)
commit8534675cefb427f33c4fa083d2751ef09acccaf5
treea592558488f33d1679f650fcd6aa3d096c30a3d2
parent756565d47079044b31b88bbcb8f71518c9526bd8
[clangd] Place cursor better after completing patterns

Summary:
By producing the $0 marker in the snippets at the last placeholder.
This produces nicer results in most cases, e.g. for
   namespace <#name#> {
     <#decls#>
   }

we now produce ${0:decls} instead of ${2:decls} and the final cursor
placement is more convenient.

Reviewers: hokein

Reviewed By: hokein

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D62389

llvm-svn: 361841
clang-tools-extra/clangd/CodeComplete.cpp
clang-tools-extra/clangd/CodeCompletionStrings.cpp
clang-tools-extra/clangd/CodeCompletionStrings.h
clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
clang-tools-extra/clangd/unittests/CodeCompletionStringsTests.cpp