1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:27:45 +00:00

HackStudio: Map connections to langauge-servers by language name

HackStudio keeps a map that stores the different ServerConnection
instances we have open.

Previously, that map was indexed by a project's root path.
This did not make much sense because we only support opening a single
project with each instance of the HackStudio program.

We now index the different ServerConnections by the language name, which
allows us to support talking to multiple language-servers in the same
project (e.g C++ and Shell).

This also fixes an issue where if you first opened a Shell file, and
then a C++ file in the same project, then C++ language-server features
would not work.
This commit is contained in:
Itamar 2021-03-04 14:12:48 +02:00 committed by Andreas Kling
parent 289c466fef
commit 74070ef74d
3 changed files with 21 additions and 29 deletions

View file

@ -32,10 +32,13 @@
#include <DevTools/HackStudio/LanguageServers/LanguageServerEndpoint.h>
#include <LibIPC/ServerConnection.h>
#define LANGUAGE_CLIENT(namespace_, socket_name) \
namespace namespace_ { \
#define LANGUAGE_CLIENT(language_name_, socket_name) \
namespace language_name_ { \
class ServerConnection : 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) \