[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 05:01:14 PDT 2019
hokein added a comment.
In D62389#1517907 <https://reviews.llvm.org/D62389#1517907>, @ilya-biryukov wrote:
> In D62389#1517844 <https://reviews.llvm.org/D62389#1517844>, @hokein wrote:
>
> > 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 `;`).
>
>
> Agree! The new behavior does not apply to function calls, they are not considered 'patterns' in the completion results.
> I.e. in your examples we're still getting `foo(${1:int a}, ${2:int b})` and the cursor is placed at the end.
>
> This is definitely worth a comment, I'll try to find a good place for it.
Ah, that makes sense! Thanks for clarifying it.
How about adding one more test in CodeCompleteTests.cpp, we already have a snippet test there, and it seems more straightforward.
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