Page MenuHomePhabricator

D63562.diff
No OneTemporary

File Metadata

Created
Mon, Aug 19, 11:21 AM

D63562.diff

Index: clang-tools-extra/trunk/clangd/ClangdServer.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/ClangdServer.cpp
+++ clang-tools-extra/trunk/clangd/ClangdServer.cpp
@@ -285,6 +285,15 @@
auto Changes = renameWithinFile(InpAST->AST, File, Pos, NewName);
if (!Changes)
return CB(Changes.takeError());
+
+ auto Style = getFormatStyleForFile(File, InpAST->Inputs.Contents,
+ InpAST->Inputs.FS.get());
+ if (auto Formatted =
+ cleanupAndFormat(InpAST->Inputs.Contents, *Changes, Style))
+ *Changes = std::move(*Formatted);
+ else
+ elog("Failed to format replacements: {0}", Formatted.takeError());
+
std::vector<TextEdit> Edits;
for (const auto &Rep : *Changes)
Edits.push_back(replacementToEdit(InpAST->Inputs.Contents, Rep));

Event Timeline