Browse Source

Language client: escape values from language server when using selection dialog

pipelines/235045657
eidheim 6 years ago
parent
commit
e08ff19358
  1. 4
      src/project.cpp
  2. 2
      src/source_language_protocol.cpp

4
src/project.cpp

@ -734,7 +734,7 @@ void Project::LanguageProtocol::show_symbols() {
if(container == "null") if(container == "null")
container.clear(); container.clear();
auto row = filesystem::get_relative_path(location.file, *project_path).string() + ':' + std::to_string(location.range.start.line + 1) + ": " + (!container.empty() ? container + "::" : "") + "<b>" + it->second.get<std::string>("name") + "</b>"; auto row = filesystem::get_relative_path(location.file, *project_path).string() + ':' + std::to_string(location.range.start.line + 1) + ": " + (!container.empty() ? Glib::Markup::escape_text(container) + "::" : "") + "<b>" + Glib::Markup::escape_text(it->second.get<std::string>("name")) + "</b>";
locations->emplace_back(std::make_pair(std::move(location), std::move(row))); locations->emplace_back(std::make_pair(std::move(location), std::move(row)));
} }
@ -777,7 +777,7 @@ void Project::LanguageProtocol::show_symbols() {
if(!container.empty()) if(!container.empty())
prefix = container + "::"; prefix = container + "::";
} }
auto row = std::to_string(location->range.start.line + 1) + ": " + prefix + "<b>" + it->second.get<std::string>("name") + "</b>"; auto row = std::to_string(location->range.start.line + 1) + ": " + Glib::Markup::escape_text(prefix) + "<b>" + Glib::Markup::escape_text(it->second.get<std::string>("name")) + "</b>";
locations->emplace_back(std::make_pair(std::move(*location), std::move(row))); locations->emplace_back(std::make_pair(std::move(*location), std::move(row)));
auto children = it->second.get_child_optional("children"); auto children = it->second.get_child_optional("children");
if(children) if(children)

2
src/source_language_protocol.cpp

@ -875,7 +875,7 @@ void Source::LanguageProtocolView::setup_navigation_and_refactoring() {
if(!container.empty()) if(!container.empty())
prefix = container + "::"; prefix = container + "::";
} }
methods.emplace_back(Offset(range->start.line, range->start.character), std::to_string(range->start.line + 1) + ": " + prefix + "<b>" + it->second.get<std::string>("name") + "</b>"); methods.emplace_back(Offset(range->start.line, range->start.character), std::to_string(range->start.line + 1) + ": " + Glib::Markup::escape_text(prefix) + "<b>" + Glib::Markup::escape_text(it->second.get<std::string>("name")) + "</b>");
} }
auto children = it->second.get_child_optional("children"); auto children = it->second.get_child_optional("children");
if(children) if(children)

Loading…
Cancel
Save