diff options
author | Itamar <itamar8910@gmail.com> | 2021-02-27 09:50:02 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-27 16:37:35 +0100 |
commit | 54bc9114b3ab741aed6cccb3e5eeb4ecd3ffc604 (patch) | |
tree | e2b7b40a562bbdfbd437b3a69d27cb9709d8a847 /Userland/DevTools/HackStudio/LanguageClient.cpp | |
parent | a94b5376bcf9428a71ad84fddb87da29c944c05e (diff) | |
download | serenity-54bc9114b3ab741aed6cccb3e5eeb4ecd3ffc604.zip |
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
Diffstat (limited to 'Userland/DevTools/HackStudio/LanguageClient.cpp')
-rw-r--r-- | Userland/DevTools/HackStudio/LanguageClient.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/DevTools/HackStudio/LanguageClient.cpp b/Userland/DevTools/HackStudio/LanguageClient.cpp index 7d701f46d2..fecd848cb8 100644 --- a/Userland/DevTools/HackStudio/LanguageClient.cpp +++ b/Userland/DevTools/HackStudio/LanguageClient.cpp @@ -25,6 +25,8 @@ */ #include "LanguageClient.h" +#include "HackStudio.h" +#include "Locator.h" #include <AK/String.h> #include <AK/Vector.h> #include <DevTools/HackStudio/LanguageServers/LanguageServerEndpoint.h> @@ -50,11 +52,6 @@ void ServerConnection::handle(const Messages::LanguageClient::DeclarationLocatio m_language_client->declaration_found(message.location().file, message.location().line, message.location().column); } -void ServerConnection::handle(const Messages::LanguageClient::DeclarationList& message) -{ - (void)message; -} - void ServerConnection::die() { dbgln("ServerConnection::die()"); @@ -158,6 +155,10 @@ void ServerConnection::remove_instance_for_project(const String& project_path) auto key = LexicalPath { project_path }.string(); s_instances_for_projects.remove(key); } +void ServerConnection::handle(const Messages::LanguageClient::DeclarationsInDocument& message) +{ + locator().set_declared_symbols(message.filename(), message.declarations()); +} void LanguageClient::search_declaration(const String& path, size_t line, size_t column) { @@ -173,7 +174,6 @@ void LanguageClient::declaration_found(const String& file, size_t line, size_t c dbgln("on_declaration_found callback is not set"); return; } - dbgln("calling on_declaration_found"); on_declaration_found(file, line, column); } |