1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 11:37:44 +00:00

HackStudio: Support searching symbol declarations in the Locator

The Locator now keeps a cache of the declared symbol in a document.
The language client updates that cache whenever it gets an update from
the language server about declared symbols.

This allows searching for symbol declarations in the Locator, in
addition to file names.

Closes #5478
This commit is contained in:
Itamar 2021-02-27 09:50:02 +02:00 committed by Andreas Kling
parent a94b5376bc
commit 54bc9114b3
16 changed files with 140 additions and 30 deletions

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "Editor.h"
#include "HackStudio.h"
#include "HackStudioWidget.h"
#include "Project.h"
@ -153,7 +154,13 @@ GUI::TextEditor& current_editor()
void open_file(const String& file_name)
{
return s_hack_studio_widget->open_file(file_name);
s_hack_studio_widget->open_file(file_name);
}
void open_file(const String& file_name, size_t line, size_t column)
{
s_hack_studio_widget->open_file(file_name);
s_hack_studio_widget->current_editor_wrapper().editor().set_cursor({ line, column });
}
RefPtr<EditorWrapper> current_editor_wrapper()
@ -180,4 +187,9 @@ void set_current_editor_wrapper(RefPtr<EditorWrapper> wrapper)
s_hack_studio_widget->set_current_editor_wrapper(wrapper);
}
Locator& locator()
{
return s_hack_studio_widget->locator();
}
}