ClientConnection.h 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (c) 2020, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include "ShellComprehensionEngine.h"
  8. #include <DevTools/HackStudio/LanguageServers/ClientConnection.h>
  9. #include <LibCpp/Parser.h>
  10. namespace LanguageServers::Shell {
  11. class ClientConnection final : public LanguageServers::ClientConnection {
  12. C_OBJECT(ClientConnection);
  13. private:
  14. ClientConnection(NonnullRefPtr<Core::LocalSocket> socket, int client_id)
  15. : LanguageServers::ClientConnection(move(socket), client_id)
  16. {
  17. m_autocomplete_engine = make<ShellComprehensionEngine>(m_filedb);
  18. m_autocomplete_engine->set_declarations_of_document_callback = [this](const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations) {
  19. async_declarations_in_document(filename, move(declarations));
  20. };
  21. m_autocomplete_engine->set_todo_entries_of_document_callback = [this](String const& filename, Vector<Cpp::Parser::TodoEntry>&& todo_entries) {
  22. async_todo_entries_in_document(filename, move(todo_entries));
  23. };
  24. }
  25. virtual ~ClientConnection() override = default;
  26. };
  27. }