ClangCodeModel: Use project-specific clangd client, if possible

If we open a file that does not belong to a currently open project, there
is a good chance that the current project's parse context is a better fit
for the file than the fallback client's.

Fixes: QTCREATORBUG-26697
Change-Id: I6c17e275b047602c51364f3203b3f0a3e74a49fc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-02-17 11:46:00 +01:00
parent 3d56b8b54a
commit 8ad7ab2d2a
3 changed files with 33 additions and 19 deletions

View File

@@ -134,7 +134,7 @@ private:
void updateLanguageClient(ProjectExplorer::Project *project,
const CppEditor::ProjectInfo::ConstPtr &projectInfo);
ClangdClient *createClient(ProjectExplorer::Project *project, const Utils::FilePath &jsonDbDir);
void claimNonProjectSources(ClangdClient *fallbackClient);
void claimNonProjectSources(ClangdClient *client);
void watchForExternalChanges();
void watchForInternalChanges();