This commit is contained in:
scturtle 2018-05-14 02:18:30 +00:00 committed by GitHub
commit e64cd88dd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 6 deletions

View File

@ -776,7 +776,7 @@ std::shared_ptr<CompletionSession> ClangCompleteManager::TryGetSession(
// If this request is for a completion, we should move it to
// |completion_sessions|.
if (mark_as_completion) {
assert(!completion_sessions_.TryGet(filename));
// assert(!completion_sessions_.TryGet(filename));
preloaded_sessions_.TryTake(filename);
completion_sessions_.Insert(filename, preloaded_session);
}

View File

@ -44,10 +44,6 @@ struct ClangCompleteManager {
using OnDiagnostic =
std::function<void(std::string path,
std::vector<lsDiagnostic> diagnostics)>;
using OnIndex = std::function<void(ClangTranslationUnit* tu,
const std::vector<CXUnsavedFile>& unsaved,
const std::string& path,
const std::vector<std::string>& args)>;
using OnComplete =
std::function<void(const std::vector<lsCompletionItem>& results,
bool is_cached_result)>;

View File

@ -8,6 +8,8 @@
#include <thread>
#include "standard_headers.inc"
namespace {
struct CompletionCandidate {
@ -96,6 +98,9 @@ void IncludeComplete::Rescan() {
absolute_path_to_completion_item.clear();
inserted_paths.clear();
for (auto& header : kStandardHeaders)
completion_items.push_back(BuildCompletionItem(header, true, true));
if (!match_ && (g_config->completion.includeWhitelist.size() ||
g_config->completion.includeBlacklist.size()))
match_ = std::make_unique<GroupMatch>(g_config->completion.includeWhitelist,

View File

@ -365,7 +365,7 @@ struct Handler_TextDocumentCompletion : MessageHandler {
lock.lock();
std::string quote = result.match[5];
for (auto& item : include_complete->completion_items)
if (quote.empty() || quote == (item.use_angle_brackets_ ? "<" : "\""))
// if (quote.empty() || quote == (item.use_angle_brackets_ ? "<" : "\""))
out.result.items.push_back(item);
}
FilterAndSortCompletionResponse(&out, result.pattern, has_open_paren);

1
src/standard_headers.inc Normal file
View File

@ -0,0 +1 @@
static const std::vector<std::string> kStandardHeaders = { "algorithm", "any", "array", "atomic", "bitset", "cassert", "ccomplex", "cctype", "cerrno", "cfenv", "cfloat", "chrono", "cinttypes", "ciso646", "climits", "clocale", "cmath", "codecvt", "complex", "complex.h", "condition_variable", "coroutine", "csetjmp", "csignal", "cstdarg", "cstdbool", "cstddef", "cstdint", "cstdio", "cstdlib", "cstring", "ctgmath", "ctime", "ctype.h", "cwchar", "cwctype", "cxxabi.h", "deque", "dynarray", "errno.h", "exception", "experimental", "ext", "filesystem", "float.h", "forward_list", "fstream", "functional", "future", "initializer_list", "inttypes.h", "iomanip", "ios", "iosfwd", "iostream", "istream", "iterator", "limits", "limits.h", "list", "locale", "locale.h", "map", "math.h", "memory", "memory_resource", "module.modulemap", "mutex", "new", "numeric", "optional", "ostream", "propagate_const", "queue", "random", "ratio", "regex", "scoped_allocator", "set", "setjmp.h", "shared_mutex", "sstream", "stack", "stdbool.h", "stddef.h", "stdexcept", "stdint.h", "stdio.h", "stdlib.h", "streambuf", "string", "string.h", "string_view", "strstream", "support", "system_error", "tgmath.h", "thread", "tuple", "typeindex", "typeinfo", "type_traits", "unordered_map", "unordered_set", "utility", "valarray", "variant", "vector", "wchar.h", "wctype.h" };