Result.Limit = Request->limit();
Result.RestrictForCodeCompletion = Request->restricted_for_code_completion();
for (const auto &Path : Request->proximity_paths()) {
- llvm::SmallString<256> LocalPath = llvm::StringRef(*LocalIndexRoot);
+ llvm::SmallString<256> LocalPath = llvm::StringRef(*RemoteIndexRoot);
llvm::sys::path::append(LocalPath, Path);
Result.ProximityPaths.push_back(std::string(LocalPath));
}
RPCRequest.set_restricted_for_code_completion(From.RestrictForCodeCompletion);
for (const auto &Path : From.ProximityPaths) {
llvm::SmallString<256> RelativePath = llvm::StringRef(Path);
- if (llvm::sys::path::replace_path_prefix(RelativePath, *RemoteIndexRoot,
+ if (llvm::sys::path::replace_path_prefix(RelativePath, *LocalIndexRoot,
""))
RPCRequest.add_proximity_paths(llvm::sys::path::convert_to_slash(
RelativePath, llvm::sys::path::Style::posix));
TEST(RemoteMarshallingTest, FuzzyFindRequestSerialization) {
clangd::FuzzyFindRequest Request;
- Request.ProximityPaths = {testPath("remote/Header.h"),
- testPath("remote/subdir/OtherHeader.h"),
- testPath("notremote/File.h"), "Not a Path."};
- Marshaller ProtobufMarshaller(testPath("remote/"), testPath("home/"));
+ Request.ProximityPaths = {testPath("local/Header.h"),
+ testPath("local/subdir/OtherHeader.h"),
+ testPath("remote/File.h"), "Not a Path."};
+ Marshaller ProtobufMarshaller(testPath("remote/"), testPath("local/"));
auto Serialized = ProtobufMarshaller.toProtobuf(Request);
EXPECT_EQ(Serialized.proximity_paths_size(), 2);
auto Deserialized = ProtobufMarshaller.fromProtobuf(&Serialized);
EXPECT_THAT(Deserialized.ProximityPaths,
- testing::ElementsAre(testPath("home/Header.h"),
- testPath("home/subdir/OtherHeader.h")));
+ testing::ElementsAre(testPath("remote/Header.h"),
+ testPath("remote/subdir/OtherHeader.h")));
}
TEST(RemoteMarshallingTest, RelativePathToURITranslation) {