File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -1972,18 +1972,18 @@ bool TypeCheckASTNodeAtLocRequest::evaluate(
1972
1972
if (Type builderType = getResultBuilderType (func)) {
1973
1973
auto optBody =
1974
1974
TypeChecker::applyResultBuilderBodyTransform (func, builderType);
1975
+ if (ctx.CompletionCallback && ctx.CompletionCallback ->gotCallback ()) {
1976
+ // We already informed the completion callback of solutions found by
1977
+ // type checking the entire result builder from
1978
+ // applyResultBuilderBodyTransform. No need to typecheck the requested
1979
+ // AST node individually anymore.
1980
+ return false ;
1981
+ }
1975
1982
if (optBody && *optBody) {
1976
1983
// Wire up the function body now.
1977
1984
func->setBody (*optBody, AbstractFunctionDecl::BodyKind::TypeChecked);
1978
1985
return false ;
1979
1986
}
1980
- // FIXME: We failed to apply the result builder transform. Fall back to
1981
- // just type checking the node that contains the code completion token.
1982
- // This may be missing some context from the result builder but in
1983
- // practice it often contains sufficient information to provide a decent
1984
- // level of code completion that's better than providing nothing at all.
1985
- // The proper solution would be to only partially type check the result
1986
- // builder so that this fall back would not be necessary.
1987
1987
} else if (func->hasSingleExpressionBody () &&
1988
1988
func->getResultInterfaceType ()->isVoid ()) {
1989
1989
// The function returns void. We don't need an explicit return, no matter
You can’t perform that action at this time.
0 commit comments