Fix identityref completion not giving module names
Issue: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/168
Change-Id: Ib1f4532e5282591e929e121d30ebbbf5d1571e0b
diff --git a/src/leaf_data.hpp b/src/leaf_data.hpp
index 2f84a05..b33d4c1 100644
--- a/src/leaf_data.hpp
+++ b/src/leaf_data.hpp
@@ -124,7 +124,14 @@
std::transform(type.m_allowedValues.begin(),
type.m_allowedValues.end(),
std::inserter(parserContext.m_suggestions, parserContext.m_suggestions.end()),
- [](auto it) { return Completion{it.m_value}; });
+ [](auto it) {
+ std::string res;
+ if constexpr (std::is_same<Type, yang::IdentityRef>()) {
+ res = it.m_prefix ? it.m_prefix->m_name + ":" : "";
+ }
+ res += it.m_value;
+ return Completion{res};
+ });
parserContext.m_completionIterator = first;
}
bool operator()(const yang::Enum& type) const