|
37 | 37 | #include "core/io/resource_loader.h" |
38 | 38 | #include "core/os/keyboard.h" |
39 | 39 | #include "core/os/os.h" |
| 40 | +#include "core/string/fuzzy_search.h" |
40 | 41 | #include "core/version.h" |
41 | 42 | #include "editor/code_editor.h" |
42 | 43 | #include "editor/debugger/editor_debugger_node.h" |
@@ -2013,13 +2014,30 @@ void ScriptEditor::_update_members_overview() { |
2013 | 2014 | functions.sort(); |
2014 | 2015 | } |
2015 | 2016 |
|
2016 | | - for (int i = 0; i < functions.size(); i++) { |
2017 | | - String filter = filter_methods->get_text(); |
2018 | | - String name = functions[i].get_slicec(':', 0); |
2019 | | - if (filter.is_empty() || filter.is_subsequence_ofn(name)) { |
| 2017 | + String filter = filter_methods->get_text(); |
| 2018 | + if (filter.is_empty()) { |
| 2019 | + for (int i = 0; i < functions.size(); i++) { |
| 2020 | + String name = functions[i].get_slicec(':', 0); |
2020 | 2021 | members_overview->add_item(name); |
2021 | 2022 | members_overview->set_item_metadata(-1, functions[i].get_slicec(':', 1).to_int() - 1); |
2022 | 2023 | } |
| 2024 | + } else { |
| 2025 | + PackedStringArray search_names; |
| 2026 | + for (int i = 0; i < functions.size(); i++) { |
| 2027 | + search_names.append(functions[i].get_slicec(':', 0)); |
| 2028 | + } |
| 2029 | + |
| 2030 | + Vector<FuzzySearchResult> results; |
| 2031 | + FuzzySearch fuzzy; |
| 2032 | + fuzzy.set_query(filter, false); |
| 2033 | + fuzzy.search_all(search_names, results); |
| 2034 | + |
| 2035 | + for (const FuzzySearchResult &res : results) { |
| 2036 | + String name = functions[res.original_index].get_slicec(':', 0); |
| 2037 | + int line = functions[res.original_index].get_slicec(':', 1).to_int() - 1; |
| 2038 | + members_overview->add_item(name); |
| 2039 | + members_overview->set_item_metadata(-1, line); |
| 2040 | + } |
2023 | 2041 | } |
2024 | 2042 |
|
2025 | 2043 | String path = se->get_edited_resource()->get_path(); |
|
0 commit comments