summaryrefslogtreecommitdiff
path: root/src/option_manager.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-08-19 18:56:11 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-08-19 18:56:11 +0100
commitbea53d09b21de050841dee75fa4cc58e71532afb (patch)
tree57af5993e8023d199e26da863c32727daf7ccf7d /src/option_manager.cc
parenta36aed94f17a93ac02f3efef35422ec3bcb5aaad (diff)
Remove option checkers, handle that through the type system
Use a specific type for InsertCompleterDesc with checks in the option_{from,to}_string functions
Diffstat (limited to 'src/option_manager.cc')
-rw-r--r--src/option_manager.cc18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/option_manager.cc b/src/option_manager.cc
index 5ad35387..f66de005 100644
--- a/src/option_manager.cc
+++ b/src/option_manager.cc
@@ -1,5 +1,7 @@
#include "option_manager.hh"
+#include "insert_completer.hh"
+
#include "assert.hh"
#include <sstream>
@@ -159,18 +161,10 @@ GlobalOptions::GlobalOptions()
declare_option("path", "path to consider when trying to find a file",
std::vector<String>({ "./", "/usr/include" }));
declare_option("completers", "insert mode completers to execute.",
- std::vector<String>({"filename", "word=all"}),
- OptionFlags::None,
- OptionChecker<std::vector<String>>([](const std::vector<String>& s) {
- static const auto values = {"word=buffer", "word=all", "filename"};
- for (auto& v : s)
- {
- if (v.substr(0_byte, 7_byte) == "option=")
- continue;
- if (not contains(values, v))
- throw runtime_error(v + " is not a recognised value for completers");
- }
- }));
+ std::vector<InsertCompleterDesc>({
+ InsertCompleterDesc{ InsertCompleterDesc::Filename },
+ InsertCompleterDesc{ InsertCompleterDesc::Word, "all"_str }
+ }), OptionFlags::None);
declare_option("autoreload",
"autoreload buffer when a filesystem modification is detected",
Ask);