Browse Source

Now runs reparse right after translationunit is created to avoid delays when starting to writing code.

merge-requests/365/head
eidheim 10 years ago
parent
commit
64994a1a5b
  1. 13
      src/source_clang.cc
  2. 1
      src/source_clang.h

13
src/source_clang.cc

@ -127,11 +127,9 @@ void Source::ClangViewParse::init_parse() {
parse_start();
}
else if (parse_thread_mapped && parsing_mutex.try_lock() && parse_thread_buffer_map_mutex.try_lock()) {
int status=0;
if(!clang_tu)
clang_tu = std::unique_ptr<clang::TranslationUnit>(new clang::TranslationUnit(clang_index, file_path.string(), get_compilation_commands(), parse_thread_buffer_map));
else
status=clang_tu->ReparseTranslationUnit(parse_thread_buffer_map);
int status=clang_tu->ReparseTranslationUnit(parse_thread_buffer_map);
if(status==0)
clang_tokens=clang_tu->get_tokens(0, parse_thread_buffer_map.find(file_path.string())->second.size()-1);
else
@ -159,20 +157,13 @@ std::map<std::string, std::string> Source::ClangViewParse::get_buffer_map() cons
void Source::ClangViewParse::start_reparse() {
parse_thread_mapped=false;
source_readable=false;
int delay;
if(!is_reparsed) {
delay=0;
is_reparsed=true;
}
else
delay=1000;
delayed_reparse_connection.disconnect();
delayed_reparse_connection=Glib::signal_timeout().connect([this]() {
source_readable=false;
parse_thread_go=true;
set_status("parsing...");
return false;
}, delay);
}, 1000);
}
std::vector<std::string> Source::ClangViewParse::get_compilation_commands() {

1
src/source_clang.h

@ -61,7 +61,6 @@ namespace Source {
static clang::Index clang_index;
std::vector<std::string> get_compilation_commands();
bool is_reparsed=false;
Glib::Dispatcher parse_done;
Glib::Dispatcher parse_start;
Glib::Dispatcher parse_fail;

Loading…
Cancel
Save