Add role to lsLocationEx

This commit is contained in:
Fangrui Song 2018-02-24 21:47:51 -08:00
parent 1469723c3c
commit 8a427dfa9e
2 changed files with 4 additions and 1 deletions

View File

@ -169,8 +169,10 @@ MAKE_REFLECT_STRUCT(lsLocation, uri, range);
// cquery extension // cquery extension
struct lsLocationEx : lsLocation { struct lsLocationEx : lsLocation {
optional<std::string_view> containerName; optional<std::string_view> containerName;
// Avoid circular dependency on symbol.h
optional<uint16_t> role;
}; };
MAKE_REFLECT_STRUCT(lsLocationEx, uri, range, containerName); MAKE_REFLECT_STRUCT(lsLocationEx, uri, range, containerName, role);
template <typename T> template <typename T>
struct lsCommand { struct lsCommand {

View File

@ -275,6 +275,7 @@ optional<lsLocationEx> GetLsLocationEx(QueryDatabase* db,
lsLocationEx ret; lsLocationEx ret;
ret.lsLocation::operator=(*ls_loc); ret.lsLocation::operator=(*ls_loc);
if (container) { if (container) {
ret.role = uint16_t(use.role);
EachEntityDef(db, use, [&](const auto& def) { EachEntityDef(db, use, [&](const auto& def) {
ret.containerName = std::string_view(def.detailed_name); ret.containerName = std::string_view(def.detailed_name);
return false; return false;