[clang-tools-extra] r366992 - [clangd] Provide help text to users who run `clangd` in a terminal.
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 25 01:00:54 PDT 2019
Author: sammccall
Date: Thu Jul 25 01:00:54 2019
New Revision: 366992
URL: http://llvm.org/viewvc/llvm-project?rev=366992&view=rev
Log:
[clangd] Provide help text to users who run `clangd` in a terminal.
Reviewers: hokein
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D65201
Modified:
clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
Modified: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp?rev=366992&r1=366991&r2=366992&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp (original)
+++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp Thu Jul 25 01:00:54 2019
@@ -515,6 +515,11 @@ clangd accepts flags on the commandline,
if (Tracer)
TracingSession.emplace(*Tracer);
+ // If a user ran `clangd` in a terminal without redirecting anything,
+ // it's somewhat likely they're confused about how to use clangd.
+ // Show them the help overview, which explains.
+ if (llvm::outs().is_displayed() && llvm::errs().is_displayed())
+ llvm::errs() << Overview << "\n";
// Use buffered stream to stderr (we still flush each log message). Unbuffered
// stream can cause significant (non-deterministic) latency for the logger.
llvm::errs().SetBuffered();
More information about the cfe-commits
mailing list