From f86708dbf57eba32d46a32b4d5e23ec6649d4a72 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 7 Feb 2017 16:10:17 +0000 Subject: [PATCH] [clangd] Strip file:// from the URI when calling formatting. It confuses FileManager on windows. llvm-svn: 294314 --- clang-tools-extra/clangd/ProtocolHandlers.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clang-tools-extra/clangd/ProtocolHandlers.cpp b/clang-tools-extra/clangd/ProtocolHandlers.cpp index 2fe7b89490b6..e2296b50fd86 100644 --- a/clang-tools-extra/clangd/ProtocolHandlers.cpp +++ b/clang-tools-extra/clangd/ProtocolHandlers.cpp @@ -63,6 +63,9 @@ static std::string formatCode(StringRef Code, StringRef Filename, // Call clang-format. // FIXME: Don't ignore style. format::FormatStyle Style = format::getLLVMStyle(); + // On windows FileManager doesn't like file://. Just strip it, clang-format + // doesn't need it. + Filename.consume_front("file://"); tooling::Replacements Replacements = format::reformat(Style, Code, Ranges, Filename);