From 8f5e06fcd1e18f59c6f56bba8680035acb49fd92 Mon Sep 17 00:00:00 2001 From: Raoul Wols Date: Sun, 29 Jul 2018 19:12:42 +0000 Subject: [PATCH] [clangd] Add command-line option to suppress the space and the circular dot prepended in a completion label. llvm-svn: 338223 --- clang-tools-extra/clangd/tool/ClangdMain.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp index 5ae5740..95ffdfa 100644 --- a/clang-tools-extra/clangd/tool/ClangdMain.cpp +++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp @@ -12,13 +12,13 @@ #include "Path.h" #include "Trace.h" #include "index/SymbolYAML.h" +#include "clang/Basic/Version.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/Program.h" #include "llvm/Support/Signals.h" #include "llvm/Support/raw_ostream.h" -#include "clang/Basic/Version.h" #include #include #include @@ -157,6 +157,13 @@ static llvm::cl::opt llvm::cl::init(clangd::CodeCompleteOptions().ShowOrigins), llvm::cl::Hidden); +static llvm::cl::opt HeaderInsertionDecorators( + "header-insertion-decorators", + llvm::cl::desc("Prepend a circular dot or space before the completion " + "label, depending on wether " + "an include line will be inserted or not."), + llvm::cl::init(true)); + static llvm::cl::opt YamlSymbolFile( "yaml-symbol-file", llvm::cl::desc( @@ -276,6 +283,10 @@ int main(int argc, char *argv[]) { CCOpts.Limit = LimitResults; CCOpts.BundleOverloads = CompletionStyle != Detailed; CCOpts.ShowOrigins = ShowOrigins; + if (!HeaderInsertionDecorators) { + CCOpts.IncludeIndicator.Insert.clear(); + CCOpts.IncludeIndicator.NoInsert.clear(); + } // Initialize and run ClangdLSPServer. ClangdLSPServer LSPServer(Out, CCOpts, CompileCommandsDirPath, Opts); -- 2.7.4