1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:08:13 +00:00

HackStudio+LanguageServers/Cpp: Show scope of symbols in Locator

This commit is contained in:
Itamar 2021-03-23 12:32:45 +02:00 committed by Andreas Kling
parent 6054a418e5
commit 84e34d76d8
10 changed files with 52 additions and 13 deletions

View file

@ -77,8 +77,11 @@ public:
return GUI::FileIconProvider::icon_for_path(suggestion.as_filename.value());
}
if (suggestion.is_symbol_declaration()) {
if (index.column() == Column::Name)
return suggestion.as_symbol_declaration.value().name;
if (index.column() == Column::Name) {
if (suggestion.as_symbol_declaration.value().scope.is_null())
return suggestion.as_symbol_declaration.value().name;
return String::formatted("{}::{}", suggestion.as_symbol_declaration.value().scope, suggestion.as_symbol_declaration.value().name);
}
if (index.column() == Column::Filename)
return suggestion.as_symbol_declaration.value().position.file;
if (index.column() == Column::Icon) {
@ -225,7 +228,7 @@ void Locator::update_suggestions()
for (auto& item : m_document_to_declarations) {
for (auto& decl : item.value) {
if (decl.name.contains(typed_text, CaseSensitivity::CaseInsensitive))
if (decl.name.contains(typed_text, CaseSensitivity::CaseInsensitive) || decl.scope.contains(typed_text, CaseSensitivity::CaseInsensitive))
suggestions.append((LocatorSuggestionModel::Suggestion::create_symbol_declaration(decl)));
}
}