Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-26205

Client manager confusion when switching clients for a document

    XMLWordPrintable

Details

    • Linux/X11
    • 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.

      Attachments

        For Gerrit Dashboard: QTCREATORBUG-26205
        # Subject Branch Project Status CR V

        Activity

          People

            davschul David Schulz
            kandeler Christian Kandeler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes