Browse Source

Language protocol: now reads the full hover result

merge-requests/365/head
eidheim 8 years ago
parent
commit
e9d3a731a1
  1. 15
      src/source_language_protocol.cc

15
src/source_language_protocol.cc

@ -917,11 +917,16 @@ void Source::LanguageProtocolView::show_type_tooltips(const Gdk::Rectangle &rect
if(!error) { if(!error) {
// hover result structure vary significantly from the different language servers // hover result structure vary significantly from the different language servers
std::string content; std::string content;
{ auto contents_pt=result.get_child("contents", boost::property_tree::ptree());
auto contents_pt=result.get_child("contents", boost::property_tree::ptree()); for(auto it=contents_pt.begin();it!=contents_pt.end();++it) {
auto contents_it=contents_pt.begin(); auto value=it->second.get<std::string>("value", "");
if(contents_it!=contents_pt.end()) if(!value.empty())
content=contents_it->second.get<std::string>("value", ""); content.insert(0, value+(content.empty()?"":"\n\n"));
else {
value=it->second.get_value<std::string>("");
if(!value.empty())
content+=(content.empty()?"":"\n\n")+value;
}
} }
if(content.empty()) { if(content.empty()) {
auto contents_it=result.find("contents"); auto contents_it=result.find("contents");

Loading…
Cancel
Save