[PATCH] D39430: [clangd] formatting: don't ignore style
Raoul Wols via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 2 15:38:46 PDT 2017
rwols added inline comments.
================
Comment at: clangd/ClangdLSPServer.cpp:93
+void ClangdLSPServer::replyWithTextEditsOrError(
+ Ctx C, std::string Code,
----------------
sammccall wrote:
> This function is pretty hard to understand from a high level - it's a bit of an odd split.
>
> Is the duplication really so bad? The straight-line code could be easy to read:
>
> auto File = Params.textDocument.uri.file;
> auto Edits = Server.formatRange(File, Params.range);
> if (Edits)
> C.reply(replacementsToEdits(Server.getDocument(File), Edits.get()));
> else
> C.replyError(Edits.takeError());
>
> (The "[" won't be needed after D39435, and we should add a replyError() overload that takes an Error)
This is a very nice idea! I'll probably update the diff tomorrow.
https://reviews.llvm.org/D39430
More information about the cfe-commits
mailing list