Userland/js: Do not construct a full CompletionSuggestion just to compare against

This commit is contained in:
AnotherTest 2020-05-22 05:43:22 +04:30 committed by Andreas Kling
parent 2427f3b38b
commit 0446b7e347
Notes: sideshowbarker 2024-07-19 06:14:01 +09:00

View File

@ -729,9 +729,9 @@ int main(int argc, char** argv)
Function<void(const JS::Shape&, const StringView&)> list_all_properties = [&results, &list_all_properties](const JS::Shape& shape, auto& property_pattern) {
for (const auto& descriptor : shape.property_table()) {
if (descriptor.key.view().starts_with(property_pattern)) {
Line::CompletionSuggestion completion { descriptor.key };
Line::CompletionSuggestion completion { descriptor.key, Line::CompletionSuggestion::ForSearch };
if (!results.contains_slow(completion)) { // hide duplicates
results.append(completion);
results.append({ descriptor.key });
}
}
}