1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:58:12 +00:00

HackStudio: Attach previous Language Client when detaching

Previously, if a new LanguageClient was created & destroyed, the
ServerConnection to the language server would be left without an
attached LanguageClient.
As a result, auto-completion results would not be updated in the UI.

Starting with this commit, the LanguageClient holds a WeakPtr to the
previous LanguageClient that was attached to the ServerConnection,
and re-attaches it after detaching itself.
This commit is contained in:
Itamar 2021-01-23 19:48:42 +02:00 committed by Andreas Kling
parent c85dad2383
commit 8ed96eb27c
2 changed files with 15 additions and 4 deletions

View file

@ -32,8 +32,11 @@ namespace HackStudio {
void ServerConnection::handle(const Messages::LanguageClient::AutoCompleteSuggestions& message)
{
if (m_language_client)
m_language_client->provide_autocomplete_suggestions(message.suggestions());
if (!m_language_client) {
dbgln("Language Server connection has no attached language client");
return;
}
m_language_client->provide_autocomplete_suggestions(message.suggestions());
}
void LanguageClient::open_file(const String& path, int fd)