add a completers option for specifying which completer to use for BufferCompleter
This commit is contained in:
parent
39f9ca33c8
commit
42d7fcacd8
|
@ -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();
|
||||
m_completions = complete_opt(cursor, m_context.options());
|
||||
if (not m_completions.is_valid())
|
||||
if (contains(completers, "option"))
|
||||
m_completions = complete_opt(cursor, m_context.options());
|
||||
if (not m_completions.is_valid() and contains(completers, "word"))
|
||||
m_completions = complete_word(cursor);
|
||||
if (not m_completions.is_valid())
|
||||
return false;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -193,6 +193,8 @@ class OptionManagerWatcher_AutoRegister
|
|||
public:
|
||||
OptionManagerWatcher_AutoRegister(OptionManager& options)
|
||||
: AutoRegister(options) {}
|
||||
|
||||
OptionManager& options() { return registry(); }
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user