[PATCH] D60605: [clangd] Revamp textDocument/onTypeFormatting.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 25 09:33:37 PDT 2019


sammccall added a comment.

In D60605#1478579 <https://reviews.llvm.org/D60605#1478579>, @ilya-biryukov wrote:

> Another example:
>
>   int test() {
>  
>     ^
>   }
>
>
> Expected: a newline was added.
>  Actual: newline does not allow to be added.


Fixed.

In D60605#1478581 <https://reviews.llvm.org/D60605#1478581>, @ilya-biryukov wrote:

> Input:
>
>   int test() {
>   }^
>
>
> Actual:
>
>   int test() {}
>   ^
>


I really do think this is the right thing in particular if you typed the brace.
It's visually confusing that hitting \n results in the cursor staying on the same line and the } moving.
And this interacts badly with the previous bug.
But can you see if this is something you could live with, and if not, explain why you don't want the {} formatted?


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D60605





More information about the cfe-commits mailing list