[clangd] Use default clang-format styles.
authorEric Liu <ioeric@google.com>
Tue, 26 Jun 2018 12:49:09 +0000 (12:49 +0000)
committerEric Liu <ioeric@google.com>
Tue, 26 Jun 2018 12:49:09 +0000 (12:49 +0000)
llvm-svn: 335598

clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/CodeComplete.cpp

index 17d09e6..10c26ee 100644 (file)
@@ -375,7 +375,8 @@ ClangdServer::formatCode(llvm::StringRef Code, PathRef File,
                          ArrayRef<tooling::Range> Ranges) {
   // Call clang-format.
   auto FS = FSProvider.getFileSystem();
-  auto Style = format::getStyle("file", File, "LLVM", Code, FS.get());
+  auto Style = format::getStyle(format::DefaultFormatStyle, File,
+                                format::DefaultFallbackStyle, Code, FS.get());
   if (!Style)
     return Style.takeError();
 
index d2e71b6..12bed7a 100644 (file)
@@ -825,10 +825,11 @@ bool semaCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer,
     // Initialize Includes if provided.
 
     // FIXME(ioeric): needs more consistent style support in clangd server.
-    auto Style = format::getStyle("file", Input.FileName, "LLVM",
-                                  Input.Contents, Input.VFS.get());
+    auto Style = format::getStyle(format::DefaultFormatStyle, Input.FileName,
+                                  format::DefaultFallbackStyle, Input.Contents,
+                                  Input.VFS.get());
     if (!Style) {
-      log("Failed to get FormatStyle for file" + Input.FileName +
+      log("ERROR: failed to get FormatStyle for file " + Input.FileName +
           ". Fall back to use LLVM style. Error: " +
           llvm::toString(Style.takeError()));
       Style = format::getLLVMStyle();