summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/ClangdServer.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2019-02-06 15:24:50 +0000
committerHaojian Wu <hokein@google.com>2019-02-06 15:24:50 +0000
commit12e194cbb7991dcc1ad56321c86fd45214526a6c (patch)
tree5840b6a89b7b995d72b66cfb9794d02d9e8bafb5 /clang-tools-extra/clangd/ClangdServer.cpp
parent54511076d4285924260ebc0791f9b9ed61703e64 (diff)
downloadbcm5719-llvm-12e194cbb7991dcc1ad56321c86fd45214526a6c.tar.gz
bcm5719-llvm-12e194cbb7991dcc1ad56321c86fd45214526a6c.zip
[clangd] Format tweak's replacements.
llvm-svn: 353306
Diffstat (limited to 'clang-tools-extra/clangd/ClangdServer.cpp')
-rw-r--r--clang-tools-extra/clangd/ClangdServer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp
index 2dcf0fb36fb..1aa87998181 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -152,6 +152,9 @@ void ClangdServer::addDocument(PathRef File, llvm::StringRef Contents,
Opts.ClangTidyOpts = tidy::ClangTidyOptions::getDefaults();
if (ClangTidyOptProvider)
Opts.ClangTidyOpts = ClangTidyOptProvider->getOptions(File);
+ // FIXME: cache this.
+ Opts.Style =
+ getFormatStyleForFile(File, Contents, FSProvider.getFileSystem().get());
Opts.SuggestMissingIncludes = SuggestMissingIncludes;
// FIXME: some build systems like Bazel will take time to preparing
// environment to build the file, it would be nice if we could emit a
@@ -372,8 +375,7 @@ void ClangdServer::applyTweak(PathRef File, Range Sel, StringRef TweakID,
auto A = prepareTweak(TweakID, *Selection);
if (!A)
return CB(A.takeError());
- // FIXME: run formatter on top of resulting replacements.
- return CB((*A)->apply(*Selection));
+ return CB((*A)->apply(*Selection, InpAST->Inputs.Opts.Style));
};
WorkScheduler.runWithAST(
"ApplyTweak", File,
OpenPOWER on IntegriCloud