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
|
|
|
|
|
|
2022-02-25 07:18:30 -03:00
|
|
|
#include <DevTools/HackStudio/LanguageServers/ConnectionFromClient.h>
|
2022-05-14 11:09:24 -03:00
|
|
|
#include <LibCodeComprehension/Cpp/CppComprehensionEngine.h>
|
2020-10-03 10:00:16 -03:00
|
|
|
|
2020-09-28 10:37:37 -03:00
|
|
|
namespace LanguageServers::Cpp {
|
|
|
|
|
|
2022-02-25 07:18:30 -03:00
|
|
|
class ConnectionFromClient final : public LanguageServers::ConnectionFromClient {
|
|
|
|
|
C_OBJECT(ConnectionFromClient);
|
2020-09-28 10:37:37 -03:00
|
|
|
|
2021-10-31 19:38:04 -03:00
|
|
|
private:
|
2022-02-25 07:18:30 -03:00
|
|
|
ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket)
|
|
|
|
|
: LanguageServers::ConnectionFromClient(move(socket))
|
2021-03-02 03:10:10 -03:00
|
|
|
{
|
2022-05-14 11:09:24 -03:00
|
|
|
m_autocomplete_engine = adopt_own(*new CodeComprehension::Cpp::CppComprehensionEngine(m_filedb));
|
|
|
|
|
m_autocomplete_engine->set_declarations_of_document_callback = [this](String const& filename, Vector<CodeComprehension::Declaration>&& declarations) {
|
2021-05-14 04:20:17 -03:00
|
|
|
async_declarations_in_document(filename, move(declarations));
|
|
|
|
|
};
|
2022-05-14 11:09:24 -03:00
|
|
|
m_autocomplete_engine->set_todo_entries_of_document_callback = [this](String const& filename, Vector<CodeComprehension::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
|
|
|
|
2022-02-25 07:18:30 -03:00
|
|
|
virtual ~ConnectionFromClient() override = default;
|
2020-09-28 10:37:37 -03:00
|
|
|
};
|
|
|
|
|
}
|