From 0dae2c4a39aa38f0721f1dd0512ea8a20c1b4bd1 Mon Sep 17 00:00:00 2001 From: Chao Shen Date: Wed, 25 Jul 2018 11:08:00 +0800 Subject: [PATCH] Fix preload completion session. --- src/clang_complete.cc | 3 +-- src/messages/textDocument_didOpen.cc | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/clang_complete.cc b/src/clang_complete.cc index 1fa09840..15656eb2 100644 --- a/src/clang_complete.cc +++ b/src/clang_complete.cc @@ -368,8 +368,7 @@ void TryEnsureDocumentParsed(ClangCompleteManager *manager, WorkingFiles::Snapshot snapshot = session->working_files->AsSnapshot( {StripFileType(session->file.filename)}); - LOG_S(INFO) << "Creating completion session with arguments " - << StringJoin(args, " "); + LOG_S(INFO) << "create completion session for " << session->file.filename; *tu = ClangTranslationUnit::Create(session->file.filename, args, snapshot, diagnostic); } diff --git a/src/messages/textDocument_didOpen.cc b/src/messages/textDocument_didOpen.cc index 70ae716b..9f6eea53 100644 --- a/src/messages/textDocument_didOpen.cc +++ b/src/messages/textDocument_didOpen.cc @@ -50,9 +50,6 @@ struct Handler_TextDocumentDidOpen } include_complete->AddFile(working_file->filename); - clang_complete->NotifyView(path); - if (g_config->diagnostics.onParse) - clang_complete->DiagnosticsUpdate({params.textDocument.uri}); if (params.args.size()) project->SetFlagsForFile(params.args, path); @@ -64,6 +61,10 @@ struct Handler_TextDocumentDidOpen clang_complete->FlushSession(entry.filename); } + + clang_complete->NotifyView(path); + if (g_config->diagnostics.onParse) + clang_complete->DiagnosticsUpdate({params.textDocument.uri}); } }; REGISTER_MESSAGE_HANDLER(Handler_TextDocumentDidOpen);