Browse Source

Added simple buffer-based completion for non-clang-files.

merge-requests/365/head
eidheim 11 years ago
parent
commit
3facceebcc
  1. 13
      juci/source.cc

13
juci/source.cc

@ -231,7 +231,7 @@ Source::GenericView::GenericView(const std::string& file_path, const std::string
auto language_manager=Gsv::LanguageManager::get_default(); auto language_manager=Gsv::LanguageManager::get_default();
bool result_uncertain = false; bool result_uncertain = false;
auto content_type = Gio::content_type_guess(file_path, get_buffer()->get_text(), result_uncertain); auto content_type = Gio::content_type_guess(file_path, get_buffer()->get_text(), result_uncertain);
if (result_uncertain) { if(result_uncertain) {
content_type.clear(); content_type.clear();
} }
auto language=language_manager->guess_language(file_path, content_type); auto language=language_manager->guess_language(file_path, content_type);
@ -245,9 +245,14 @@ Source::GenericView::GenericView(const std::string& file_path, const std::string
if(language) { if(language) {
get_source_buffer()->set_language(language); get_source_buffer()->set_language(language);
Singleton::terminal()->print("Language for file "+file_path+" set to "+language->get_name()+".\n"); Singleton::terminal()->print("Language for file "+file_path+" set to "+language->get_name()+".\n");
/*auto completion=get_completion();
if(completion) auto completion=get_completion();
cout << completion->get_providers().size() << endl;*/ auto completion_words=Gsv::CompletionWords::create("", Glib::RefPtr<Gdk::Pixbuf>());
completion_words->register_provider(get_buffer());
completion->add_provider(completion_words);
completion->property_show_headers()=false;
completion->property_show_icons()=false;
completion->property_accelerators()=0;
} }
} }

Loading…
Cancel
Save