mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Code completion: report "semantic context" for every code completion result
Semantic context describes the origin of the declaration and serves the same purpose as opaque numeric "priority" in Clang -- to determine the most likely completion. This is the initial implementation. There are a few opportunities to bump the priority of a certain decl by giving it SemanticContextKind::ExprSpecific context that are not implemented yet. Swift SVN r9052
This commit is contained in:
@@ -215,13 +215,13 @@ void TUModuleCache::lookupVisibleDecls(AccessPathTy AccessPath,
|
||||
if (I == TopLevelValues.end()) return;
|
||||
|
||||
for (auto vd : I->second)
|
||||
Consumer.foundDecl(vd);
|
||||
Consumer.foundDecl(vd, DeclVisibilityKind::VisibleAtTopLevel);
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto &tlv : TopLevelValues) {
|
||||
for (ValueDecl *vd : tlv.second)
|
||||
Consumer.foundDecl(vd);
|
||||
Consumer.foundDecl(vd, DeclVisibilityKind::VisibleAtTopLevel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ void TUModuleCache::lookupClassMembers(AccessPathTy accessPath,
|
||||
Type ty = vd->getDeclContext()->getDeclaredTypeOfContext();
|
||||
if (auto nominal = ty->getAnyNominal())
|
||||
if (nominal->getName() == accessPath.front().first)
|
||||
consumer.foundDecl(vd);
|
||||
consumer.foundDecl(vd, DeclVisibilityKind::DynamicLookup);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -247,7 +247,7 @@ void TUModuleCache::lookupClassMembers(AccessPathTy accessPath,
|
||||
|
||||
for (auto &member : ClassMembers) {
|
||||
for (ValueDecl *vd : member.second)
|
||||
consumer.foundDecl(vd);
|
||||
consumer.foundDecl(vd, DeclVisibilityKind::DynamicLookup);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user