[clang-tools-extra] r335598 - [clangd] Use default clang-format styles.

Eric Liu via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 26 05:49:10 PDT 2018


Author: ioeric
Date: Tue Jun 26 05:49:09 2018
New Revision: 335598

URL: http://llvm.org/viewvc/llvm-project?rev=335598&view=rev
Log:
[clangd] Use default clang-format styles.

Modified:
    clang-tools-extra/trunk/clangd/ClangdServer.cpp
    clang-tools-extra/trunk/clangd/CodeComplete.cpp

Modified: clang-tools-extra/trunk/clangd/ClangdServer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.cpp?rev=335598&r1=335597&r2=335598&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdServer.cpp Tue Jun 26 05:49:09 2018
@@ -375,7 +375,8 @@ ClangdServer::formatCode(llvm::StringRef
                          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();
 

Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=335598&r1=335597&r2=335598&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original)
+++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Tue Jun 26 05:49:09 2018
@@ -825,10 +825,11 @@ bool semaCodeComplete(std::unique_ptr<Co
     // 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();




More information about the cfe-commits mailing list