add a completers option for specifying which completer to use for BufferCompleter

This commit is contained in:
Maxime Coste 2013-05-03 18:38:12 +02:00
parent 39f9ca33c8
commit 42d7fcacd8
3 changed files with 7 additions and 2 deletions

View File

@ -664,9 +664,11 @@ private:
{
if (not m_completions.is_valid())
{
auto& completers = options()["completers"].get<std::vector<String>>();
BufferIterator cursor = m_context.editor().main_selection().last();
if (contains(completers, "option"))
m_completions = complete_opt(cursor, m_context.options());
if (not m_completions.is_valid())
if (not m_completions.is_valid() and contains(completers, "word"))
m_completions = complete_word(cursor);
if (not m_completions.is_valid())
return false;

View File

@ -119,6 +119,7 @@ GlobalOptions::GlobalOptions()
declare_option<String>("filetype", "");
declare_option<std::vector<String>>("completions", {});
declare_option<std::vector<String>>("path", { "./", "/usr/include" });
declare_option<std::vector<String>>("completers", {"option", "word"});
declare_option<bool>("insert_hide_sel", false);
}

View File

@ -193,6 +193,8 @@ class OptionManagerWatcher_AutoRegister
public:
OptionManagerWatcher_AutoRegister(OptionManager& options)
: AutoRegister(options) {}
OptionManager& options() { return registry(); }
};