1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:27:35 +00:00

LanguageServers: Remove ClientConnection dependency

We now no longer need to provide a ClientConnection object to construct
AutoCompleteEngine.
This commit is contained in:
Itamar 2021-05-14 10:20:17 +03:00 committed by Andreas Kling
parent 687efe6dd6
commit c49cf23a86
12 changed files with 24 additions and 29 deletions

View file

@ -14,8 +14,8 @@ namespace LanguageServers::Shell {
RefPtr<::Shell::Shell> AutoComplete::s_shell {};
AutoComplete::AutoComplete(ClientConnection& connection, const FileDB& filedb)
: AutoCompleteEngine(connection, filedb, true)
AutoComplete::AutoComplete(const FileDB& filedb)
: AutoCompleteEngine(filedb, true)
{
}

View file

@ -13,7 +13,7 @@ namespace LanguageServers::Shell {
class AutoComplete : public AutoCompleteEngine {
public:
AutoComplete(ClientConnection&, const FileDB& filedb);
AutoComplete(const FileDB& filedb);
virtual Vector<GUI::AutocompleteProvider::Entry> get_suggestions(const String& file, const GUI::TextPosition& position) override;
virtual void on_edit(const String& file) override;
virtual void file_opened([[maybe_unused]] const String& file) override;

View file

@ -17,8 +17,10 @@ class ClientConnection final : public LanguageServers::ClientConnection {
ClientConnection(NonnullRefPtr<Core::LocalSocket> socket, int client_id)
: LanguageServers::ClientConnection(move(socket), client_id)
{
m_autocomplete_engine = make<AutoComplete>(*this, m_filedb);
m_autocomplete_engine->set_declarations_of_document_callback = &ClientConnection::set_declarations_of_document_callback;
m_autocomplete_engine = make<AutoComplete>(m_filedb);
m_autocomplete_engine->set_declarations_of_document_callback = [this](const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations) {
async_declarations_in_document(filename, move(declarations));
};
}
virtual ~ClientConnection() override = default;