|
|
|
@ -16,30 +16,21 @@ namespace Source { |
|
|
|
namespace LanguageProtocol { |
|
|
|
namespace LanguageProtocol { |
|
|
|
class Offset { |
|
|
|
class Offset { |
|
|
|
public: |
|
|
|
public: |
|
|
|
Offset(const boost::property_tree::ptree &pt) : line(pt.get<int>("line")), |
|
|
|
Offset(const boost::property_tree::ptree &pt); |
|
|
|
character(pt.get<int>("character")) {} |
|
|
|
|
|
|
|
int line; |
|
|
|
int line; |
|
|
|
int character; |
|
|
|
int character; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class Range { |
|
|
|
class Range { |
|
|
|
public: |
|
|
|
public: |
|
|
|
Range(const boost::property_tree::ptree &pt) : start(pt.get_child("start")), |
|
|
|
Range(const boost::property_tree::ptree &pt); |
|
|
|
end(pt.get_child("end")) {} |
|
|
|
|
|
|
|
Range() = default; |
|
|
|
Range() = default; |
|
|
|
Offset start, end; |
|
|
|
Offset start, end; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class Location { |
|
|
|
class Location { |
|
|
|
public: |
|
|
|
public: |
|
|
|
Location(const boost::property_tree::ptree &pt, std::string uri_ = {}) : range(pt.get_child("range")) { |
|
|
|
Location(const boost::property_tree::ptree &pt, std::string uri_ = {}); |
|
|
|
if(uri_.empty()) { |
|
|
|
|
|
|
|
uri = pt.get<std::string>("uri"); |
|
|
|
|
|
|
|
uri.erase(0, 7); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
uri = std::move(uri_); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
std::string uri; |
|
|
|
std::string uri; |
|
|
|
Range range; |
|
|
|
Range range; |
|
|
|
}; |
|
|
|
}; |
|
|
|
@ -48,19 +39,12 @@ namespace LanguageProtocol { |
|
|
|
public: |
|
|
|
public: |
|
|
|
class RelatedInformation { |
|
|
|
class RelatedInformation { |
|
|
|
public: |
|
|
|
public: |
|
|
|
RelatedInformation(const boost::property_tree::ptree &pt) : message(pt.get<std::string>("message")), |
|
|
|
RelatedInformation(const boost::property_tree::ptree &pt); |
|
|
|
location(pt.get_child("location")) {} |
|
|
|
|
|
|
|
std::string message; |
|
|
|
std::string message; |
|
|
|
Location location; |
|
|
|
Location location; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Diagnostic(const boost::property_tree::ptree &pt) : message(pt.get<std::string>("message")), |
|
|
|
Diagnostic(const boost::property_tree::ptree &pt); |
|
|
|
range(pt.get_child("range")), |
|
|
|
|
|
|
|
severity(pt.get<int>("severity", 0)) { |
|
|
|
|
|
|
|
auto related_information_it = pt.get_child("relatedInformation", boost::property_tree::ptree()); |
|
|
|
|
|
|
|
for(auto it = related_information_it.begin(); it != related_information_it.end(); ++it) |
|
|
|
|
|
|
|
related_informations.emplace_back(it->second); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
std::string message; |
|
|
|
std::string message; |
|
|
|
Range range; |
|
|
|
Range range; |
|
|
|
int severity; |
|
|
|
int severity; |
|
|
|
@ -69,8 +53,7 @@ namespace LanguageProtocol { |
|
|
|
|
|
|
|
|
|
|
|
class TextEdit { |
|
|
|
class TextEdit { |
|
|
|
public: |
|
|
|
public: |
|
|
|
TextEdit(const boost::property_tree::ptree &pt, std::string new_text_ = {}) : range(pt.get_child("range")), |
|
|
|
TextEdit(const boost::property_tree::ptree &pt, std::string new_text_ = {}); |
|
|
|
new_text(new_text_.empty() ? pt.get<std::string>("newText") : std::move(new_text_)) {} |
|
|
|
|
|
|
|
Range range; |
|
|
|
Range range; |
|
|
|
std::string new_text; |
|
|
|
std::string new_text; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|