summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/Diagnostics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/Diagnostics.cpp')
-rw-r--r--clang-tools-extra/clangd/Diagnostics.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/Diagnostics.cpp b/clang-tools-extra/clangd/Diagnostics.cpp
index 73ac475efef..5a61567f2dc 100644
--- a/clang-tools-extra/clangd/Diagnostics.cpp
+++ b/clang-tools-extra/clangd/Diagnostics.cpp
@@ -145,6 +145,13 @@ void printDiag(llvm::raw_string_ostream &OS, const DiagBase &D) {
OS << diagLeveltoString(D.Severity) << ": " << D.Message;
}
+/// Capitalizes the first word in the diagnostic's message.
+std::string capitalize(std::string Message) {
+ if (!Message.empty())
+ Message[0] = llvm::toUpper(Message[0]);
+ return Message;
+}
+
/// Returns a message sent to LSP for the main diagnostic in \p D.
/// The message includes all the notes with their corresponding locations.
/// However, notes with fix-its are excluded as those usually only contain a
@@ -166,7 +173,7 @@ std::string mainMessage(const Diag &D) {
printDiag(OS, Note);
}
OS.flush();
- return Result;
+ return capitalize(std::move(Result));
}
/// Returns a message sent to LSP for the note of the main diagnostic.
@@ -179,7 +186,7 @@ std::string noteMessage(const Diag &Main, const DiagBase &Note) {
OS << "\n\n";
printDiag(OS, Main);
OS.flush();
- return Result;
+ return capitalize(std::move(Result));
}
} // namespace
OpenPOWER on IntegriCloud