当前位置: 首页>>代码示例>>C#>>正文


C# CompletionDataWrapper.AddNamedParameterVariable方法代码示例

本文整理汇总了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;
开发者ID:pentp,项目名称:SharpDevelop,代码行数:67,代码来源:CSharpCompletionEngine.cs

示例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);
				}
			}
		}
开发者ID:pentp,项目名称:SharpDevelop,代码行数:21,代码来源:CSharpCompletionEngine.cs

示例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;
		}
开发者ID:pentp,项目名称:SharpDevelop,代码行数:45,代码来源:CSharpCompletionEngine.cs

示例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;
        }
开发者ID:kaagati,项目名称:NRefactory,代码行数:62,代码来源:CSharpCompletionEngine.cs


注:本文中的ICSharpCode.NRefactory.CSharp.Completion.CompletionDataWrapper.AddNamedParameterVariable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。