[clangd-dev] textDocument/onTypeFormatting and live indentation.
Ilya Biryukov via clangd-dev
clangd-dev at lists.llvm.org
Fri Sep 7 04:04:19 PDT 2018
The proposal looks promising, but why only reindent? Here are two useful
type-as-you-go heuristics that I've seen ('^' indicates cursor position
before and after adding a newline):
1. Reformatting braces.
before:
if (foo) {^}
after (note two newlines were added, so strictly speaking it's not just a
reindent):
if (foo) {
^
}
with a different brace formatting style:
if (foo)
{
^
}
2. Auto-typing comment markers.
before:
/// Comment line 1.^
/// Comment line 2.
int foo();
after:
/// Comment line 1.
/// ^
/// Comment line 2.
With a different comment type. Before:
/** Comment line 1. ^
* Comment line 2.
*/
after:
/** Comment line 1.
* ^
* Comment line 2.
*/
On Thu, Sep 6, 2018 at 8:27 PM Alex L via clangd-dev <
clangd-dev at lists.llvm.org> wrote:
> Hi,
>
> I would like to implement clang-format aware newline indentation in
> Clangd. It looks like Clangd only supports '}' trigger character for the
> 'onTypeFormatting' request. Would it make sense to extend it to support the
> newline character, and to insert appropriate indentation instead of
> reformatting the range in that case?
>
> Cheers,
> Alex
> _______________________________________________
> clangd-dev mailing list
> clangd-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev
>
--
Regards,
Ilya Biryukov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/clangd-dev/attachments/20180907/775af501/attachment.html>
More information about the clangd-dev
mailing list