[PATCH] D62389: [clangd] Place cursor better after completing patterns

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 27 01:37:42 PDT 2019


hokein added a comment.

I'm not sure the new behavior suits all cases, it seems to me that this will change a typical behavior (usually when users invoke function calls).

Imaging a case:

  void foo(int a, int b);
  
  void call() {
    fo^
  }



- before, the final cursor is at the end of the snippet
- after, the final cursor is at the last parameter of `foo`.

I think the previous cursor location is more convenient (user can continue typing `;`).



================
Comment at: clang-tools-extra/clangd/CodeCompletionStrings.h:41
 ///   *Signature = "(size_type) const"
-///   *Snippet = "(${0:size_type})"
+///   *Snippet = "(${1:size_type})"
 /// If set, RequiredQualifiers is the text that must be typed before the name.
----------------
IIUC, I think we will still return `${0}` with the new behavior, `size_type` is the only placeholder here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62389/new/

https://reviews.llvm.org/D62389





More information about the cfe-commits mailing list