1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 14:54:57 +00:00
serenity/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.h
Ben Wiederhake 3796d417e0 Demos+DevTools+Games: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.
2021-11-02 22:56:53 +01:00

32 lines
1.1 KiB
C++

/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "ShellComprehensionEngine.h"
#include <DevTools/HackStudio/LanguageServers/ClientConnection.h>
#include <LibCpp/Parser.h>
namespace LanguageServers::Shell {
class ClientConnection final : public LanguageServers::ClientConnection {
C_OBJECT(ClientConnection);
private:
ClientConnection(NonnullRefPtr<Core::LocalSocket> socket, int client_id)
: LanguageServers::ClientConnection(move(socket), client_id)
{
m_autocomplete_engine = make<ShellComprehensionEngine>(m_filedb);
m_autocomplete_engine->set_declarations_of_document_callback = [this](const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations) {
async_declarations_in_document(filename, move(declarations));
};
m_autocomplete_engine->set_todo_entries_of_document_callback = [this](String const& filename, Vector<Cpp::Parser::TodoEntry>&& todo_entries) {
async_todo_entries_in_document(filename, move(todo_entries));
};
}
virtual ~ClientConnection() override = default;
};
}