public static IVariable FindFunctionDefinitionByName(this IScope scope, string name, int position) { var variables = scope.GetApplicableVariables(position); var v = variables.FirstOrDefault(x => (x.Value is RFunction) && x.Name.EqualsOrdinal(name)); return v; }