LanguageClient: Allow to look up the document for a given file path

Change-Id: I565ce07b28008edbc9d40178069b078ff3530744
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-04-29 15:39:37 +02:00
parent c63148fa21
commit b4e8d32189
2 changed files with 10 additions and 0 deletions

View File

@@ -589,6 +589,15 @@ bool Client::documentOpen(const TextEditor::TextDocument *document) const
return m_openedDocument.contains(const_cast<TextEditor::TextDocument *>(document));
}
TextEditor::TextDocument *Client::documentForFilePath(const Utils::FilePath &file) const
{
for (auto it = m_openedDocument.cbegin(); it != m_openedDocument.cend(); ++it) {
if (it.key()->filePath() == file)
return it.key();
}
return nullptr;
}
void Client::documentContentsSaved(TextEditor::TextDocument *document)
{
if (!m_openedDocument.contains(document))