forked from OSchip/llvm-project
[clangd] Complete the fix for (Local|Remote)IndexRoot confusion
Related revision: https://reviews.llvm.org/D83826
This commit is contained in:
parent
510e37c88c
commit
7d591e123e
|
@ -61,7 +61,7 @@ Marshaller::fromProtobuf(const FuzzyFindRequest *Request) {
|
|||
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));
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ FuzzyFindRequest Marshaller::toProtobuf(const clangd::FuzzyFindRequest &From) {
|
|||
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));
|
||||
|
|
|
@ -282,16 +282,16 @@ TEST(RemoteMarshallingTest, IncludeHeaderURIs) {
|
|||
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue