in resharper/src/CSharp/Completions/GodotSmartCompletion.cs [134:170]
private bool LookupInputActions(IInvocationExpression invocationExpression,
CSharpCodeCompletionContext context, IItemsCollector collector)
{
var containingType = invocationExpression.InvokedMethodContainingType();
if (!GodotTypes.Input.Equals(containingType) && !GodotTypes.InputEvent.Equals(containingType))
return false;
if (context.NodeInFile.Parent is not { Parent: ICSharpArgument argument })
return false;
if (argument.MatchingParameter == null ||
argument.MatchingParameter.Type is not IDeclaredType declaredType)
return false;
if (!Equals(declaredType.GetClrName().GetPersistent(), GodotTypes.StringName))
return false;
var client = context.BasicContext.Solution.GetComponent<GodotMessagingClient>();
var fullPath = context.BasicContext.SourceFile.GetLocation().FullPath;
var task = client.SendInputActionsRequest(fullPath);
if (!task.Wait(TimeSpan.FromSeconds(.5)))
{
myLogger.Error("Call to the GodotEditor SendInputActionsRequest wasn't finished in 0.5 seconds.");
return false;
}
var response = task.Result;
if (response == null)
return false;
foreach (var suggestion in response.Suggestions)
{
var item = new StringLiteralItem(suggestion);
item.InitializeRanges(context.CompletionRanges, context.BasicContext);
collector.Add(item);
}
return true;
}