Browse Source

Language protocol: simplified LanguageProtocol::Offset::Offset

merge-requests/398/head
eidheim 7 years ago
parent
commit
27b973e6d3
  1. 12
      src/source_language_protocol.cc

12
src/source_language_protocol.cc

@ -24,16 +24,8 @@ LanguageProtocol::Offset::Offset(const boost::property_tree::ptree &pt) {
} }
catch(...) { catch(...) {
// Workaround for buggy rls // Workaround for buggy rls
auto line = pt.get<std::size_t>("line"); line = std::min(pt.get<std::size_t>("line"), static_cast<std::size_t>(std::numeric_limits<int>::max()));
auto character = pt.get<std::size_t>("character"); character = std::min(pt.get<std::size_t>("character"), static_cast<std::size_t>(std::numeric_limits<int>::max()));
if(line > static_cast<std::size_t>(std::numeric_limits<int>::max()))
this->line = std::numeric_limits<int>::max();
else
this->line = line;
if(character > static_cast<std::size_t>(std::numeric_limits<int>::max()))
this->character = std::numeric_limits<int>::max();
else
this->character = character;
} }
} }
LanguageProtocol::Range::Range(const boost::property_tree::ptree &pt) : start(pt.get_child("start")), end(pt.get_child("end")) {} LanguageProtocol::Range::Range(const boost::property_tree::ptree &pt) : start(pt.get_child("start")), end(pt.get_child("end")) {}

Loading…
Cancel
Save