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 "CppComprehensionEngine.h"
  8. #include <DevTools/HackStudio/LanguageServers/ClientConnection.h>
  9. namespace LanguageServers::Cpp {
  10. class ClientConnection final : public LanguageServers::ClientConnection {
  11. C_OBJECT(ClientConnection);
  12. private:
  13. ClientConnection(NonnullRefPtr<Core::LocalSocket> socket, int client_id)
  14. : LanguageServers::ClientConnection(move(socket), client_id)
  15. {
  16. m_autocomplete_engine = make<CppComprehensionEngine>(m_filedb);
  17. m_autocomplete_engine->set_declarations_of_document_callback = [this](const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations) {
  18. async_declarations_in_document(filename, move(declarations));
  19. };
  20. m_autocomplete_engine->set_todo_entries_of_document_callback = [this](String const& filename, Vector<Cpp::Parser::TodoEntry>&& todo_entries) {
  21. async_todo_entries_in_document(filename, move(todo_entries));
  22. };
  23. }
  24. virtual ~ClientConnection() override = default;
  25. };
  26. }