ClangdClient: Do not close temporarily opened files

... if they have been properly opened in the meantime.
This fixes the problem that when a file was opened indirectly via "Go to
definition", the didClose message for the file that we temporarily opened
to search for overrides sometimes came in after the "regular" opening of
the file. As a result, such files were not actually in clangd's open
documents set, and no functionality was available for them (e.g. F2 on a
symbol would do nothing).
Also remove a left-over related declaration.

Change-Id: I9fc85d95595cb38a8d92e3f46505b9c514537d21
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-07-12 11:24:19 +02:00
parent e429aaa43b
commit d603654aca

View File

@@ -540,8 +540,10 @@ public:
void closeTempDocuments()
{
for (const Utils::FilePath &fp : qAsConst(openedFiles))
for (const Utils::FilePath &fp : qAsConst(openedFiles)) {
if (!q->documentForFilePath(fp))
q->closeExtraFile(fp);
}
openedFiles.clear();
}
@@ -690,7 +692,6 @@ public:
void sendGotoImplementationRequest(const Utils::Link &link);
void handleGotoImplementationResult(const GotoImplementationRequest::Response &response);
void handleDocumentInfoResults();
void closeTempDocuments();
void handleDeclDefSwitchReplies();