Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
Qt Creator 6.0.0-beta1
-
None
-
-
dc40af5fa57f6ed5cfd9cfecb3d8f09e8de726f8 (qt-creator/tqtc-qt-creator/5.0) 07cfae77ba (qt-creator/qt-creator/qmlprojectstorage)
Description
1. Enable clangd in the C++ settings.
2. Create a project with a simple source file that triggers a diagnostic, e.g.:
int main()
{
i = 5;
}
3. Open the file (not the project!). A diagnostic will appear (though somewhat subdued, because the file has no project).
4. Now open the project; don't close the file.
5. Observe that no diagnostics are shown anymore. It will stay that way until you close and re-open the file (editing does not help).
Background info:
At step 4, our clangd support closes the document in the fallback client and opens it in the project-specific client. The LSP inspector shows that this does indeed result in didClose and didOpen messages in the expected order. (Possibly relevant, or not: The server sends a diagnostics message with an empty list of diagnostics to the fallback client right after receiving the didClose message.) The inspector also shows that the project-specific server sends correct diagnostics messages. Debugging shows that for these, Client::handleDiagnostics() does not call m_diagnosticManager.showDiagnostics(), because LanguageClientManager::clientForUri() does not return the right client. Apparently, the document -> client map is not properly updated.
The issue appears to be 100% reproducible.
Note that the problem is relevant in practice because of sessions.