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


C# NRefactoryResolver.AddAccessibleCodeCompletionData方法代码示例

本文整理汇总了C#中NRefactoryResolver.AddAccessibleCodeCompletionData方法的典型用法代码示例。如果您正苦于以下问题:C# NRefactoryResolver.AddAccessibleCodeCompletionData方法的具体用法?C# NRefactoryResolver.AddAccessibleCodeCompletionData怎么用?C# NRefactoryResolver.AddAccessibleCodeCompletionData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NRefactoryResolver的用法示例。


在下文中一共展示了NRefactoryResolver.AddAccessibleCodeCompletionData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateParameterCompletion

		public CompletionDataList CreateParameterCompletion (NRefactoryResolver resolver, DomLocation location, ExpressionContext context, IEnumerable<IMethod> possibleMethods, int parameter)
		{
			CompletionDataList completionList = new ProjectDomCompletionDataList ();
			var addedEnums = new HashSet<string> ();
			var addedDelegates = new HashSet<string> ();
			IType resolvedType = null;
			foreach (var method in possibleMethods) {
				if (method.Parameters.Count <= parameter)
					continue;
				resolvedType = dom.GetType (method.Parameters [parameter].ReturnType);
				if (resolvedType == null)
					continue;
				switch (resolvedType.ClassType) {
				case MonoDevelop.Projects.Dom.ClassType.Enum:
					if (addedEnums.Contains (resolvedType.DecoratedFullName))
						continue;
					addedEnums.Add (resolvedType.DecoratedFullName);
					AddEnumMembers (completionList, resolvedType);
					break;
				case MonoDevelop.Projects.Dom.ClassType.Delegate:
					if (addedDelegates.Contains (resolvedType.DecoratedFullName))
						continue;
					addedDelegates.Add (resolvedType.DecoratedFullName);
					string parameterDefinition = AddDelegateHandlers (completionList, resolvedType, false, addedDelegates.Count == 1);
					string varName = "Handle" + method.Parameters [parameter].ReturnType.Name + method.Parameters [parameter].Name;
					completionList.Add (new EventCreationCompletionData (textEditorData, varName, resolvedType, null, parameterDefinition, resolver.Unit.GetMemberAt (location), resolvedType) { AddSemicolon = false });
					break;
				}
			}
			if (addedEnums.Count + addedDelegates.Count == 0)
				return null;
			CompletionDataCollector cdc = new CompletionDataCollector (this, dom, completionList, Document.CompilationUnit, resolver.CallingType, location);
			completionList.AutoCompleteEmptyMatch = false;
			completionList.AutoSelect = false;
			resolver.AddAccessibleCodeCompletionData (ExpressionContext.MethodBody, cdc);
			if (addedDelegates.Count > 0) {
				foreach (var data in completionList) {
					if (data is MemberCompletionData) 
						((MemberCompletionData)data).IsDelegateExpected = true;
				}
			}
			return completionList;
		}
开发者ID:rohdef,项目名称:monodevelop,代码行数:43,代码来源:CSharpTextEditorCompletion.cs

示例2: CreatePossibleEnumCompletion

		public CompletionDataList CreatePossibleEnumCompletion (NRefactoryResolver resolver, DomLocation location, ExpressionContext context, IEnumerable<IMethod> possibleMethods, int parameter)
		{
			CompletionDataList completionList = new ProjectDomCompletionDataList ();
			var addedEnums = new HashSet<string> ();
			IType resolvedType = null;
			foreach (var method in possibleMethods) {
				if (method.Parameters.Count <= parameter)
					continue;
				resolvedType = dom.GetType (method.Parameters [parameter].ReturnType);
				if (resolvedType == null || resolvedType.ClassType != ClassType.Enum)
					continue;
				if (addedEnums.Contains (resolvedType.DecoratedFullName))
					continue;
				addedEnums.Add (resolvedType.DecoratedFullName);
				AddEnumMembers (completionList, resolvedType);
			}
			if (addedEnums.Count == 0)
				return null;
			CompletionDataCollector cdc = new CompletionDataCollector (dom, completionList, Document.CompilationUnit, resolver.CallingType, location);
			completionList.AutoCompleteEmptyMatch = false;
			//completionList.AutoSelect = false;
			resolver.AddAccessibleCodeCompletionData (context, cdc);
			return completionList;
		}
开发者ID:okrmartin,项目名称:monodevelop,代码行数:24,代码来源:CSharpTextEditorCompletion.cs


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