diff --git a/src/project.cc b/src/project.cc index d8b26dc..4e66c3a 100644 --- a/src/project.cc +++ b/src/project.cc @@ -731,13 +731,11 @@ void Project::LanguageProtocol::show_symbols() { try { ::LanguageProtocol::Location location(it->second.get_child("location")); if(filesystem::file_in_path(location.file, *project_path)) { - ::LanguageProtocol::Location location(it->second.get_child("location")); + auto container = it->second.get("containerName", ""); + if(container == "null") + container.clear(); - std::string row = filesystem::get_relative_path(location.file, *project_path).string() + ':'; - auto container_name = it->second.get("containerName", ""); - if(!container_name.empty() && container_name != "null") - row += container_name + ':'; - row += std::to_string(location.range.start.line + 1) + ": " + it->second.get("name") + ""; + auto row = filesystem::get_relative_path(location.file, *project_path).string() + ':' + std::to_string(location.range.start.line + 1) + ": " + (!container.empty() ? container + "::" : "") + "" + it->second.get("name") + ""; locations_rows.emplace(std::move(location), std::move(row)); } @@ -766,11 +764,10 @@ void Project::LanguageProtocol::show_symbols() { try { ::LanguageProtocol::Location location(it->second.get_child("location")); - std::string row; - auto container_name = it->second.get("containerName", ""); - if(!container_name.empty() && container_name != "null") - row += container_name + ':'; - row += std::to_string(location.range.start.line + 1) + ": " + it->second.get("name") + ""; + auto container = it->second.get("containerName", ""); + if(container == "null") + container.clear(); + auto row = std::to_string(location.range.start.line + 1) + ": " + (!container.empty() ? container + "::" : "") + "" + it->second.get("name") + ""; locations_rows.emplace(std::move(location), std::move(row)); } diff --git a/src/source_language_protocol.cc b/src/source_language_protocol.cc index 5109285..d523244 100644 --- a/src/source_language_protocol.cc +++ b/src/source_language_protocol.cc @@ -150,6 +150,8 @@ LanguageProtocol::Capabilities LanguageProtocol::Client::initialize(Source::Lang capabilities.document_formatting = capabilities_pt->second.get("documentFormattingProvider", false); capabilities.document_range_formatting = capabilities_pt->second.get("documentRangeFormattingProvider", false); capabilities.rename = capabilities_pt->second.get("renameProvider", false); + if(!capabilities.rename) + capabilities.rename = capabilities_pt->second.get("renameProvider.prepareProvider", false); capabilities.type_coverage = capabilities_pt->second.get("typeCoverageProvider", false); } @@ -848,22 +850,20 @@ void Source::LanguageProtocolView::setup_navigation_and_refactoring() { try { auto kind = it->second.get("kind"); if(kind == 6 || kind == 9 || kind == 12) { - std::string row; std::unique_ptr range; + std::string container; auto location_pt = it->second.get_child_optional("location"); if(location_pt) { LanguageProtocol::Location location(*location_pt); - auto container_name = it->second.get("containerName", ""); - if(!container_name.empty() && container_name != "null") - row += container_name + ':'; + container = it->second.get("containerName", ""); + if(container == "null") + container.clear(); range = std::make_unique(location.range); } else range = std::make_unique(it->second.get_child("range")); - row += std::to_string(range->start.line + 1) + ": " + it->second.get("name") + ""; - - methods.emplace_back(Offset(range->start.line, range->start.character), std::move(row)); + methods.emplace_back(Offset(range->start.line, range->start.character), std::to_string(range->start.line + 1) + ": " + (!container.empty() ? container + "::" : "") + "" + it->second.get("name") + ""); } } catch(...) {