summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio/LanguageClients/ServerConnections.h
blob: 9f88ae8acc66b0d39fafd8781b3d2ef3e23b2c8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include "../LanguageClient.h"
#include <AK/LexicalPath.h>
#include <DevTools/HackStudio/LanguageServers/LanguageClientEndpoint.h>
#include <DevTools/HackStudio/LanguageServers/LanguageServerEndpoint.h>
#include <LibIPC/ServerConnection.h>

#define LANGUAGE_CLIENT(language_name_, socket_name)                                           \
    namespace language_name_ {                                                                 \
    class ServerConnection final : public HackStudio::ServerConnection {                       \
        C_OBJECT(ServerConnection)                                                             \
    public:                                                                                    \
        static const char* language_name() { return #language_name_; }                         \
                                                                                               \
    private:                                                                                   \
        ServerConnection(const String& project_path)                                           \
            : HackStudio::ServerConnection("/tmp/portal/language/" #socket_name, project_path) \
        {                                                                                      \
        }                                                                                      \
    };                                                                                         \
    }

namespace LanguageClients {

LANGUAGE_CLIENT(Cpp, cpp)
LANGUAGE_CLIENT(Shell, shell)

}

#undef LANGUAGE_CLIENT