2020-09-28 10:37:37 -03:00
|
|
|
/*
|
2021-03-02 03:10:10 -03:00
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
2020-09-28 10:37:37 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-09-28 10:37:37 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2021-05-16 11:25:24 -03:00
|
|
|
#include "CppComprehensionEngine.h"
|
2021-03-02 03:10:10 -03:00
|
|
|
#include <DevTools/HackStudio/LanguageServers/ClientConnection.h>
|
2020-10-03 10:00:16 -03:00
|
|
|
|
2020-09-28 10:37:37 -03:00
|
|
|
namespace LanguageServers::Cpp {
|
|
|
|
|
|
2021-03-02 03:10:10 -03:00
|
|
|
class ClientConnection final : public LanguageServers::ClientConnection {
|
2020-09-28 10:37:37 -03:00
|
|
|
C_OBJECT(ClientConnection);
|
|
|
|
|
|
|
|
|
|
public:
|
2021-03-02 03:10:10 -03:00
|
|
|
ClientConnection(NonnullRefPtr<Core::LocalSocket> socket, int client_id)
|
|
|
|
|
: LanguageServers::ClientConnection(move(socket), client_id)
|
|
|
|
|
{
|
2021-05-16 11:25:24 -03:00
|
|
|
m_autocomplete_engine = make<CppComprehensionEngine>(m_filedb);
|
2021-05-14 04:20:17 -03:00
|
|
|
m_autocomplete_engine->set_declarations_of_document_callback = [this](const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations) {
|
|
|
|
|
async_declarations_in_document(filename, move(declarations));
|
|
|
|
|
};
|
2021-06-01 18:54:55 -03:00
|
|
|
m_autocomplete_engine->set_todo_entries_of_document_callback = [this](String const& filename, Vector<Cpp::Parser::TodoEntry>&& todo_entries) {
|
2021-05-17 17:19:50 -03:00
|
|
|
async_todo_entries_in_document(filename, move(todo_entries));
|
|
|
|
|
};
|
2021-03-02 03:10:10 -03:00
|
|
|
}
|
2020-09-28 10:37:37 -03:00
|
|
|
|
2021-03-02 03:10:10 -03:00
|
|
|
virtual ~ClientConnection() override = default;
|
2020-09-28 10:37:37 -03:00
|
|
|
};
|
|
|
|
|
}
|