summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs b/clang/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs
index d16d6d50414..efb2147f2b4 100644
--- a/clang/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs
+++ b/clang/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs
@@ -326,7 +326,13 @@ namespace LLVM.ClangFormat
string filePath = Vsix.GetDocumentPath(view);
var path = Path.GetDirectoryName(filePath);
+
string text = view.TextBuffer.CurrentSnapshot.GetText();
+ if (!text.EndsWith(Environment.NewLine))
+ {
+ view.TextBuffer.Insert(view.TextBuffer.CurrentSnapshot.Length, Environment.NewLine);
+ text += Environment.NewLine;
+ }
RunClangFormatAndApplyReplacements(text, 0, text.Length, path, filePath, options, view);
}
OpenPOWER on IntegriCloud