forked from OSchip/llvm-project
[clangd] Fix off-by-one in CodeComplete and assertion in Dex
llvm-svn: 365955
This commit is contained in:
parent
77dd8a7928
commit
697de1c24e
|
@ -1391,12 +1391,12 @@ private:
|
|||
unsigned RangeEnd = HeuristicPrefix.Qualifier.begin() - Content.data(),
|
||||
RangeBegin = RangeEnd;
|
||||
for (size_t I = 0; I < 3 && RangeBegin > 0; ++I) {
|
||||
auto PrevNL = Content.rfind('\n', RangeBegin - 1);
|
||||
auto PrevNL = Content.rfind('\n', RangeBegin);
|
||||
if (PrevNL == StringRef::npos) {
|
||||
RangeBegin = 0;
|
||||
break;
|
||||
}
|
||||
RangeBegin = PrevNL + 1;
|
||||
RangeBegin = PrevNL;
|
||||
}
|
||||
|
||||
ContextWords = collectWords(Content.slice(RangeBegin, RangeEnd));
|
||||
|
|
|
@ -316,9 +316,9 @@ std::vector<std::string> generateProximityURIs(llvm::StringRef URIPath) {
|
|||
// FIXME(kbobyrev): Parsing and encoding path to URIs is not necessary and
|
||||
// could be optimized.
|
||||
Body = llvm::sys::path::parent_path(Body, llvm::sys::path::Style::posix);
|
||||
URI TokenURI(ParsedURI->scheme(), ParsedURI->authority(), Body);
|
||||
if (!Body.empty())
|
||||
Result.emplace_back(TokenURI.toString());
|
||||
Result.emplace_back(
|
||||
URI(ParsedURI->scheme(), ParsedURI->authority(), Body).toString());
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue