From 9cc234fbdfb33b3fa0056b865d9381ea72f47f8c Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 23 Feb 2021 09:22:11 +0100 Subject: [PATCH] LanguageClient: Add the project display name to the client name If the client was opened for a specific project. Change-Id: Iafc9f5d46d06e2e656702260f297d6b2b998a431 Reviewed-by: Christian Stenger --- src/plugins/languageclient/client.cpp | 7 +++++++ src/plugins/languageclient/client.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp index 7d1c657ca86..74384691ada 100644 --- a/src/plugins/languageclient/client.cpp +++ b/src/plugins/languageclient/client.cpp @@ -100,6 +100,13 @@ Client::Client(BaseClientInterface *clientInterface) &Client::rehighlight); } +QString Client::name() const +{ + if (m_project && !m_project->displayName().isEmpty()) + return tr("%1 for %2").arg(m_displayName, m_project->displayName()); + return m_displayName; +} + static void updateEditorToolBar(QList documents) { for (TextEditor::TextDocument *document : documents) { diff --git a/src/plugins/languageclient/client.h b/src/plugins/languageclient/client.h index 420f33a45cd..e3edbf88b52 100644 --- a/src/plugins/languageclient/client.h +++ b/src/plugins/languageclient/client.h @@ -87,7 +87,7 @@ public: // basic properties Utils::Id id() const { return m_id; } void setName(const QString &name) { m_displayName = name; } - QString name() const { return m_displayName; } + QString name() const; void sendContent(const LanguageServerProtocol::IContent &content); void cancelRequest(const LanguageServerProtocol::MessageId &id);