From a0e76254de093ef0ea2fe2d75953dd6d78de2e45 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 10 Mar 2019 08:55:01 -0700 Subject: [PATCH] Add initialization option index.name.suppressUnwrittenScope (default: false) --- src/config.hh | 8 +++++++- src/indexer.cc | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/config.hh b/src/config.hh index e4360660..ccddb2ab 100644 --- a/src/config.hh +++ b/src/config.hh @@ -273,6 +273,11 @@ struct Config { std::vector multiVersionBlacklist; std::vector multiVersionWhitelist; + struct Name { + // Suppress inline and unnamed namespaces in identifier names. + bool suppressUnwrittenScope = false; + } name; + // Allow indexing on textDocument/didChange. // May be too slow for big projects, so it is off by default. bool onChange = false; @@ -338,9 +343,10 @@ REFLECT_STRUCT(Config::Completion, caseSensitivity, detailedLabel, REFLECT_STRUCT(Config::Diagnostics, blacklist, onChange, onOpen, onSave, spellChecking, whitelist) REFLECT_STRUCT(Config::Highlight, largeFileSize, lsRanges, blacklist, whitelist) +REFLECT_STRUCT(Config::Index::Name, suppressUnwrittenScope); REFLECT_STRUCT(Config::Index, blacklist, comments, initialBlacklist, initialWhitelist, maxInitializerLines, multiVersion, - multiVersionBlacklist, multiVersionWhitelist, onChange, + multiVersionBlacklist, multiVersionWhitelist, name, onChange, parametersInDeclarations, threads, trackDependency, whitelist); REFLECT_STRUCT(Config::Request, timeout); REFLECT_STRUCT(Config::Session, maxNum); diff --git a/src/indexer.cc b/src/indexer.cc index 51ca076a..f4e9be8b 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -490,6 +490,7 @@ public: PP.PolishForDeclaration = true; PP.ConstantsAsWritten = true; PP.SuppressTagKeyword = true; + PP.SuppressUnwrittenScope = g_config->index.name.suppressUnwrittenScope; PP.SuppressInitializers = true; PP.FullyQualifiedName = false; return PP;