Browse Source

Language protocol: added error message if request to server timed out. Also corrected error argument on handlers called on timeout or process error

merge-requests/389/head
eidheim 7 years ago
parent
commit
b61ff41300
  1. 5
      src/source_language_protocol.cc

5
src/source_language_protocol.cc

@ -283,10 +283,11 @@ void LanguageProtocol::Client::write_request(Source::LanguageProtocolView *view,
std::unique_lock<std::mutex> lock(read_write_mutex); std::unique_lock<std::mutex> lock(read_write_mutex);
auto id_it = handlers.find(message_id); auto id_it = handlers.find(message_id);
if(id_it != handlers.end()) { if(id_it != handlers.end()) {
Terminal::get().async_print("Request to language server timed out. If you suspect the server has crashed, please close and reopen all project source files.\n", true);
auto function = std::move(id_it->second.second); auto function = std::move(id_it->second.second);
handlers.erase(id_it->first); handlers.erase(id_it->first);
lock.unlock(); lock.unlock();
function(boost::property_tree::ptree(), false); function(boost::property_tree::ptree(), true);
lock.lock(); lock.lock();
} }
}); });
@ -302,7 +303,7 @@ void LanguageProtocol::Client::write_request(Source::LanguageProtocolView *view,
auto function = std::move(id_it->second.second); auto function = std::move(id_it->second.second);
handlers.erase(id_it->first); handlers.erase(id_it->first);
lock.unlock(); lock.unlock();
function(boost::property_tree::ptree(), false); function(boost::property_tree::ptree(), true);
lock.lock(); lock.lock();
} }
} }

Loading…
Cancel
Save