forked from qt-creator/qt-creator
LSP: Use localSource
This change allows the LSP to find a local version of a source file even if the server is running on a remote device. Change-Id: I274cb327ad958ac3c4486859da666702758b7d42 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -2080,10 +2080,16 @@ bool Client::fileBelongsToProject(const Utils::FilePath &filePath) const
|
|||||||
return project() && project()->isKnownFile(filePath);
|
return project() && project()->isKnownFile(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilePath toHostPath(const FilePath serverDeviceTemplate, const FilePath localClientPath)
|
||||||
|
{
|
||||||
|
const FilePath onDevice = serverDeviceTemplate.withNewPath(localClientPath.path());
|
||||||
|
return onDevice.localSource().value_or(onDevice);
|
||||||
|
}
|
||||||
|
|
||||||
DocumentUri::PathMapper Client::hostPathMapper() const
|
DocumentUri::PathMapper Client::hostPathMapper() const
|
||||||
{
|
{
|
||||||
return [serverDeviceTemplate = d->m_serverDeviceTemplate](const Utils::FilePath &serverPath) {
|
return [serverDeviceTemplate = d->m_serverDeviceTemplate](const Utils::FilePath &serverPath) {
|
||||||
return serverDeviceTemplate.withNewPath(serverPath.path());
|
return toHostPath(serverDeviceTemplate, serverPath);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user