From 49308057ea8649b68d055e82d776dbaf6fbdb3e9 Mon Sep 17 00:00:00 2001 From: eidheim Date: Mon, 30 Jul 2018 14:42:23 +0200 Subject: [PATCH] Language protocol: fixed apply_similar_symbol_tag when document_highlight is unavailable --- src/source_language_protocol.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/source_language_protocol.cc b/src/source_language_protocol.cc index 7e1bf00..2704127 100644 --- a/src/source_language_protocol.cc +++ b/src/source_language_protocol.cc @@ -1063,9 +1063,12 @@ void Source::LanguageProtocolView::apply_similar_symbol_tag() { client->write_request(this, method, R"("textDocument":{"uri":"file://)" + file_path.string() + R"("}, "position": {"line": )" + std::to_string(iter.get_line()) + ", \"character\": " + std::to_string(iter.get_line_offset()) + R"(}, "context": {"includeDeclaration": true})", [this, current_request](const boost::property_tree::ptree &result, bool error) { if(!error) { std::vector ranges; + std::string uri; + if(!capabilities.document_highlight) + uri = "file://" + file_path.string(); for(auto it = result.begin(); it != result.end(); ++it) { try { - if(capabilities.document_highlight || it->second.get("uri") == file_path) + if(capabilities.document_highlight || it->second.get("uri") == uri) ranges.emplace_back(it->second.get_child("range")); } catch(...) {