diff options
author | Itamar <itamar8910@gmail.com> | 2021-03-04 14:12:48 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-06 09:40:33 +0100 |
commit | 74070ef74dae78fed179f80ee18f5b079b8843ef (patch) | |
tree | ca8d0571f166f1430d7d3bc7599d66f50e9675e7 /Userland/DevTools/HackStudio/LanguageClients | |
parent | 289c466fef0dfb2cac35f0c989f3eb2b3d93c345 (diff) | |
download | serenity-74070ef74dae78fed179f80ee18f5b079b8843ef.zip |
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.
Diffstat (limited to 'Userland/DevTools/HackStudio/LanguageClients')
-rw-r--r-- | Userland/DevTools/HackStudio/LanguageClients/ServerConnections.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Userland/DevTools/HackStudio/LanguageClients/ServerConnections.h b/Userland/DevTools/HackStudio/LanguageClients/ServerConnections.h index 89266e37ca..d26f32f272 100644 --- a/Userland/DevTools/HackStudio/LanguageClients/ServerConnections.h +++ b/Userland/DevTools/HackStudio/LanguageClients/ServerConnections.h @@ -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) \ |