Unify enum and identityref completion
I could reuse it in the end!
Change-Id: I20abc8eb9305c4420f422c6d99ef3d4552ae336a
diff --git a/src/ast_handlers.cpp b/src/ast_handlers.cpp
index 8aa6470..7738085 100644
--- a/src/ast_handlers.cpp
+++ b/src/ast_handlers.cpp
@@ -25,3 +25,15 @@
}
return leafDataToString(value);
}
+
+template<>
+decltype(ParserContext::m_suggestions) createSetSuggestions_class<yang::LeafDataTypes::Enum>::getSuggestions(const ParserContext& parserContext, const Schema& schema) const
+{
+ return schema.enumValues(parserContext.m_tmpListKeyLeafPath.m_location, parserContext.m_tmpListKeyLeafPath.m_node);
+}
+
+template<>
+decltype(ParserContext::m_suggestions) createSetSuggestions_class<yang::LeafDataTypes::IdentityRef>::getSuggestions(const ParserContext& parserContext, const Schema& schema) const
+{
+ return schema.validIdentities(parserContext.m_tmpListKeyLeafPath.m_location, parserContext.m_tmpListKeyLeafPath.m_node, Prefixes::WhenNeeded);
+}