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