本文整理汇总了C#中ICSharpCode.NRefactory.CSharp.Completion.CompletionDataWrapper.AddNamedParameterVariable方法的典型用法代码示例。如果您正苦于以下问题:C# CompletionDataWrapper.AddNamedParameterVariable方法的具体用法?C# CompletionDataWrapper.AddNamedParameterVariable怎么用?C# CompletionDataWrapper.AddNamedParameterVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.NRefactory.CSharp.Completion.CompletionDataWrapper
的用法示例。
在下文中一共展示了CompletionDataWrapper.AddNamedParameterVariable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MagicKeyCompletion
//.........这里部分代码省略.........
}
}
// Handle object/enumerable initialzer expressions: "new O () { P$"
if (n is IdentifierExpression && n.Parent is ArrayInitializerExpression && !(n.Parent.Parent is ArrayCreateExpression)) {
var result = HandleObjectInitializer(identifierStart.Unit, n);
if (result != null)
return result;
}
if (n != null && n.Parent is InvocationExpression ||
n.Parent is ParenthesizedExpression && n.Parent.Parent is InvocationExpression) {
if (n.Parent is ParenthesizedExpression)
n = n.Parent;
var invokeParent = (InvocationExpression)n.Parent;
var invokeResult = ResolveExpression(
invokeParent.Target
);
var mgr = invokeResult != null ? invokeResult.Result as MethodGroupResolveResult : null;
if (mgr != null) {
int idx = 0;
foreach (var arg in invokeParent.Arguments) {
if (arg == n) {
break;
}
idx++;
}
foreach (var method in mgr.Methods) {
if (idx < method.Parameters.Count && method.Parameters [idx].Type.Kind == TypeKind.Delegate) {
AutoSelect = false;
AutoCompleteEmptyMatch = false;
}
foreach (var p in method.Parameters) {
contextList.AddNamedParameterVariable(p);
}
}
idx++;
foreach (var list in mgr.GetEligibleExtensionMethods (true)) {
foreach (var method in list) {
if (idx < method.Parameters.Count && method.Parameters [idx].Type.Kind == TypeKind.Delegate) {
AutoSelect = false;
AutoCompleteEmptyMatch = false;
}
}
}
}
}
if (n != null && n.Parent is ObjectCreateExpression) {
var invokeResult = ResolveExpression(n.Parent);
var mgr = invokeResult != null ? invokeResult.Result as ResolveResult : null;
if (mgr != null) {
foreach (var constructor in mgr.Type.GetConstructors ()) {
foreach (var p in constructor.Parameters) {
contextList.AddVariable(p);
}
}
}
}
if (n is IdentifierExpression) {
var bop = n.Parent as BinaryOperatorExpression;
Expression evaluationExpr = null;
if (bop != null && bop.Right == n && (bop.Operator == BinaryOperatorType.Equality || bop.Operator == BinaryOperatorType.InEquality)) {
evaluationExpr = bop.Left;
示例2: AddAttributeProperties
static void AddAttributeProperties(CompletionDataWrapper wrapper, ResolveResult resolved)
{
if (resolved == null || resolved.Type.Kind == TypeKind.Unknown)
return;
foreach (var property in resolved.Type.GetProperties (p => p.Accessibility == Accessibility.Public)) {
var data = wrapper.AddMember(property);
if (data != null)
data.DisplayFlags |= DisplayFlags.NamedArgument;
}
foreach (var field in resolved.Type.GetFields (p => p.Accessibility == Accessibility.Public)) {
var data = wrapper.AddMember(field);
if (data != null)
data.DisplayFlags |= DisplayFlags.NamedArgument;
}
foreach (var constructor in resolved.Type.GetConstructors (p => p.Accessibility == Accessibility.Public)) {
foreach (var p in constructor.Parameters) {
wrapper.AddNamedParameterVariable(p);
}
}
}
示例3: CreateParameterCompletion
IEnumerable<ICompletionData> CreateParameterCompletion(MethodGroupResolveResult resolveResult, CSharpResolver state, AstNode invocation, SyntaxTree unit, int parameter, bool controlSpace)
{
var result = new CompletionDataWrapper(this);
var addedEnums = new HashSet<string>();
var addedDelegates = new HashSet<string>();
foreach (var method in resolveResult.Methods) {
CreateParameterForInvocation(result, method, state, parameter, addedEnums, addedDelegates);
}
foreach (var methods in resolveResult.GetEligibleExtensionMethods (true)) {
foreach (var method in methods) {
if (resolveResult.Methods.Contains(method))
continue;
CreateParameterForInvocation(result, new ReducedExtensionMethod(method), state, parameter, addedEnums, addedDelegates);
}
}
foreach (var method in resolveResult.Methods) {
if (parameter < method.Parameters.Count && method.Parameters [parameter].Type.Kind == TypeKind.Delegate) {
AutoSelect = false;
AutoCompleteEmptyMatch = false;
}
foreach (var p in method.Parameters) {
result.AddNamedParameterVariable(p);
}
}
if (!controlSpace) {
if (addedEnums.Count + addedDelegates.Count == 0) {
return Enumerable.Empty<ICompletionData>();
}
AutoCompleteEmptyMatch = false;
AutoSelect = false;
}
AddContextCompletion(result, state, invocation);
// resolver.AddAccessibleCodeCompletionData (ExpressionContext.MethodBody, cdc);
// if (addedDelegates.Count > 0) {
// foreach (var data in result.Result) {
// if (data is MemberCompletionData)
// ((MemberCompletionData)data).IsDelegateExpected = true;
// }
// }
return result.Result;
}
示例4: CreateParameterCompletion
IEnumerable<ICompletionData> CreateParameterCompletion(MethodGroupResolveResult resolveResult, CSharpResolver state, AstNode invocation, SyntaxTree unit, int parameter, bool controlSpace)
{
var result = new CompletionDataWrapper(this);
var addedEnums = new HashSet<string>();
var addedDelegates = new HashSet<string>();
foreach (var method in resolveResult.Methods) {
if (method.Parameters.Count <= parameter) {
continue;
}
var resolvedType = method.Parameters [parameter].Type;
if (resolvedType.Kind == TypeKind.Enum) {
if (addedEnums.Contains(resolvedType.ReflectionName)) {
continue;
}
addedEnums.Add(resolvedType.ReflectionName);
AddEnumMembers(result, resolvedType, state);
} else if (resolvedType.Kind == TypeKind.Delegate) {
if (addedDelegates.Contains(resolvedType.ReflectionName))
continue;
string parameterDefinition = AddDelegateHandlers(result, resolvedType, false);
string varName = "Handle" + method.Parameters [parameter].Type.Name + method.Parameters [parameter].Name;
result.Result.Add(
factory.CreateEventCreationCompletionData(
varName,
resolvedType,
null,
parameterDefinition,
currentMember,
currentType)
);
}
}
foreach (var method in resolveResult.Methods) {
if (parameter < method.Parameters.Count && method.Parameters [parameter].Type.Kind == TypeKind.Delegate) {
AutoSelect = false;
AutoCompleteEmptyMatch = false;
}
foreach (var p in method.Parameters) {
result.AddNamedParameterVariable(p);
}
}
if (!controlSpace) {
if (addedEnums.Count + addedDelegates.Count == 0) {
return Enumerable.Empty<ICompletionData>();
}
AutoCompleteEmptyMatch = false;
AutoSelect = false;
}
AddContextCompletion(result, state, invocation);
// resolver.AddAccessibleCodeCompletionData (ExpressionContext.MethodBody, cdc);
// if (addedDelegates.Count > 0) {
// foreach (var data in result.Result) {
// if (data is MemberCompletionData)
// ((MemberCompletionData)data).IsDelegateExpected = true;
// }
// }
return result.Result;
}