forked from qt-creator/qt-creator
LanguageClient: Do not assert on opening the same document twice
Just silently ignore a second open. This is now consistent with LanguageClientManager::openDocumentWithClient that also supports calling it multiple times with the same document client combination. Change-Id: I6e8eaf312805cd4e82070209b414d63433158360 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -358,7 +358,7 @@ void Client::setClientCapabilities(const LanguageServerProtocol::ClientCapabilit
|
|||||||
void Client::openDocument(TextEditor::TextDocument *document)
|
void Client::openDocument(TextEditor::TextDocument *document)
|
||||||
{
|
{
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
if (!isSupportedDocument(document))
|
if (m_openedDocument.contains(document) || !isSupportedDocument(document))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_state != Initialized) {
|
if (m_state != Initialized) {
|
||||||
@@ -366,8 +366,6 @@ void Client::openDocument(TextEditor::TextDocument *document)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTC_ASSERT(!m_openedDocument.contains(document), return);
|
|
||||||
|
|
||||||
const FilePath &filePath = document->filePath();
|
const FilePath &filePath = document->filePath();
|
||||||
const QString method(DidOpenTextDocumentNotification::methodName);
|
const QString method(DidOpenTextDocumentNotification::methodName);
|
||||||
if (Utils::optional<bool> registered = m_dynamicCapabilities.isRegistered(method)) {
|
if (Utils::optional<bool> registered = m_dynamicCapabilities.isRegistered(method)) {
|
||||||
|
Reference in New Issue
Block a user