diff --git a/Userland/DevTools/HackStudio/HackStudio.h b/Userland/DevTools/HackStudio/HackStudio.h index c8ad04170f..962c9d3b69 100644 --- a/Userland/DevTools/HackStudio/HackStudio.h +++ b/Userland/DevTools/HackStudio/HackStudio.h @@ -21,6 +21,7 @@ void open_file(const String&, size_t line, size_t column); Project& project(); String currently_open_file(); void set_current_editor_wrapper(RefPtr); +void for_each_open_file(Function); class Locator; Locator& locator(); diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index 1e47b20aba..7bf0509c1f 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -1484,4 +1484,11 @@ void HackStudioWidget::open_coredump(String const& coredump_path) } } +void HackStudioWidget::for_each_open_file(Function func) +{ + for (auto& open_file : m_open_files) { + func(*open_file.value); + } +} + } diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.h b/Userland/DevTools/HackStudio/HackStudioWidget.h index 1e6342d486..7a9ea47fe0 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.h +++ b/Userland/DevTools/HackStudio/HackStudioWidget.h @@ -69,6 +69,7 @@ public: }; void open_coredump(String const& coredump_path); + void for_each_open_file(Function); private: static String get_full_path_of_serenity_source(const String& file); diff --git a/Userland/DevTools/HackStudio/main.cpp b/Userland/DevTools/HackStudio/main.cpp index a0c4650dc8..4ead5ec113 100644 --- a/Userland/DevTools/HackStudio/main.cpp +++ b/Userland/DevTools/HackStudio/main.cpp @@ -168,4 +168,9 @@ Locator& locator() return s_hack_studio_widget->locator(); } +void for_each_open_file(Function func) +{ + s_hack_studio_widget->for_each_open_file(move(func)); +} + }