mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CodeCompletion] Make sure callback is always called from performOperation
We had some situations left that neither returned an error, nor called the callback with results in `performOperation`. Return an error in these and adjust the tests to correctly match the error.
This commit is contained in:
@@ -190,8 +190,15 @@ static void swiftCodeCompleteImpl(
|
||||
ide::makeCodeCompletionCallbacksFactory(CompletionContext,
|
||||
Consumer));
|
||||
|
||||
auto *SF = CI.getCodeCompletionFile();
|
||||
performCodeCompletionSecondPass(*SF, *callbacksFactory);
|
||||
if (!Result->DidFindCodeCompletionToken) {
|
||||
Callback(ResultType::success(
|
||||
{/*HasResults=*/false, &CI.getASTContext(), &CI.getInvocation(),
|
||||
&CompletionContext, /*RequestedModules=*/{}, /*DC=*/nullptr}));
|
||||
return;
|
||||
}
|
||||
|
||||
performCodeCompletionSecondPass(*CI.getCodeCompletionFile(),
|
||||
*callbacksFactory);
|
||||
if (!Consumer.HandleResultWasCalled) {
|
||||
// If we didn't receive a handleResult call from the second pass,
|
||||
// we didn't receive any results. To make sure Callback gets called
|
||||
|
||||
Reference in New Issue
Block a user