[CodeComplete] Show global completions from modules that are imported as @_spi

If a module is imported as `@_spi`, we didn’t receive any global completions from it.

rdar://99027179
This commit is contained in:
Alex Hoppen
2022-08-24 23:52:21 +02:00
parent fd4e98a51e
commit bd2771e756
4 changed files with 118 additions and 8 deletions

View File

@@ -484,6 +484,12 @@ static std::string getName(StringRef cacheDirectory,
<< (K.AddInitsInToplevel ? "-inits" : "")
<< (K.AddCallWithNoDefaultArgs ? "-nodefaults" : "")
<< (K.Annotated ? "-annotated" : "");
if (K.SpiGroups.size() > 0) {
OSS << "-spi";
for (auto SpiGroup : K.SpiGroups) {
OSS << "-" << SpiGroup;
}
}
// name[-access-path-components]
for (StringRef component : K.AccessPath)
@@ -548,9 +554,16 @@ OnDiskCodeCompletionCache::getFromFile(StringRef filename) {
return None;
// Make up a key for readCachedModule.
CodeCompletionCache::Key K{filename.str(), "<module-name>", {},
false, false, false,
false, false, false};
CodeCompletionCache::Key K{/*ModuleFilename=*/filename.str(),
/*ModuleName=*/"<module-name>",
/*AccessPath=*/{},
/*ResultsHaveLeadingDot=*/false,
/*ForTestableLookup=*/false,
/*ForPrivateImportLookup=*/false,
/*SpiGroups=*/{},
/*AddInitsInToplevel=*/false,
/*AddCallWithNoDefaultArgs=*/false,
/*Annotated=*/false};
// Read the cached results.
auto V = CodeCompletionCache::createValue();