|
|
|
|
@ -1210,17 +1210,22 @@ Source::GenericView::GenericView(const boost::filesystem::path &file_path, Glib:
|
|
|
|
|
catch(const std::exception &e) { |
|
|
|
|
Singleton::terminal()->print("Error: error parsing language file "+language_file.string()+": "+e.what()+'\n'); |
|
|
|
|
} |
|
|
|
|
add_keywords(completion_buffer_keywords, pt); |
|
|
|
|
bool has_context_class=false; |
|
|
|
|
parse_language_file(completion_buffer_keywords, has_context_class, pt); |
|
|
|
|
if(!has_context_class) |
|
|
|
|
spellcheck_all=false; |
|
|
|
|
completion_words->register_provider(completion_buffer_keywords); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Source::GenericView::add_keywords(Glib::RefPtr<CompletionBuffer> &completion_buffer, const boost::property_tree::ptree &pt) { |
|
|
|
|
void Source::GenericView::parse_language_file(Glib::RefPtr<CompletionBuffer> &completion_buffer, bool &has_context_class, const boost::property_tree::ptree &pt) { |
|
|
|
|
bool case_insensitive=false; |
|
|
|
|
for(auto &node: pt) { |
|
|
|
|
if(node.first=="<xmlcomment>") { |
|
|
|
|
if(static_cast<std::string>(node.second.data())==" case insensitive ") |
|
|
|
|
auto data=static_cast<std::string>(node.second.data()); |
|
|
|
|
std::transform(data.begin(), data.end(), data.begin(), ::tolower); |
|
|
|
|
if(data.find("case insensitive")!=std::string::npos) |
|
|
|
|
case_insensitive=true; |
|
|
|
|
} |
|
|
|
|
else if(node.first=="keyword") { |
|
|
|
|
@ -1231,8 +1236,14 @@ void Source::GenericView::add_keywords(Glib::RefPtr<CompletionBuffer> &completio
|
|
|
|
|
completion_buffer->insert_at_cursor(data+'\n'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if(!has_context_class && node.first=="context") { |
|
|
|
|
auto class_attribute=node.second.get<std::string>("<xmlattr>.class", ""); |
|
|
|
|
auto class_disabled_attribute=node.second.get<std::string>("<xmlattr>.class-disabled", ""); |
|
|
|
|
if(class_attribute.size()>0 || class_disabled_attribute.size()>0) |
|
|
|
|
has_context_class=true; |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
add_keywords(completion_buffer, node.second); |
|
|
|
|
parse_language_file(completion_buffer, has_context_class, node.second); |
|
|
|
|
} |
|
|
|
|
catch(const std::exception &e) {
|
|
|
|
|
} |
|
|
|
|
@ -2125,7 +2136,7 @@ Source::ClangViewAutocomplete(file_path, project_path, language) {
|
|
|
|
|
for(auto &mark: marks) { |
|
|
|
|
renaming=true; |
|
|
|
|
get_buffer()->erase(mark.first->get_iter(), mark.second->get_iter()); |
|
|
|
|
get_buffer()->insert_with_tag(mark.first->get_iter(), text, similar_tokens_tag); |
|
|
|
|
get_buffer()->insert(mark.first->get_iter(), text); |
|
|
|
|
get_buffer()->delete_mark(mark.first); |
|
|
|
|
get_buffer()->delete_mark(mark.second); |
|
|
|
|
} |
|
|
|
|
|