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


C# TooltipInformation.AddCategory方法代码示例

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


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

示例1: CreateTooltipInformation

		public virtual Task<TooltipInformation> CreateTooltipInformation (bool smartWrap, CancellationToken cancelToken)
		{
			var tt = new TooltipInformation ();
			if (!string.IsNullOrEmpty (Description))
				tt.AddCategory (null, Description);
			return Task.FromResult (tt);
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:CompletionData.cs

示例2: CreateTooltipBody

		static void CreateTooltipBody(TooltipMarkupGen markupGen, DNode dn, TooltipInformation tti)
		{
			string summary;
			Dictionary<string,string> categories;

			markupGen.GenToolTipBody (dn, out summary, out categories);

			tti.SummaryMarkup = summary;
			if (categories != null)
				foreach (var kv in categories)
					tti.AddCategory (kv.Key, kv.Value);
		}
开发者ID:DinrusGroup,项目名称:Mono-D,代码行数:12,代码来源:TooltipInfoGen.cs

示例3: CreateTooltipInformation

        public override TooltipInformation CreateTooltipInformation(int overload, int currentParameter, bool smartWrap)
        {
            selIndex = overload;
            var tti = new TooltipInformation();
            var sb = new StringBuilder();

            var t = CurrentResult;
            var ds = t as DSymbol;

            if (ds is MemberSymbol && ds.Definition is DMethod)
            {
                var dm = ds.Definition as DMethod;

                sb.Append("<i>(");
                string name;
                switch (dm.SpecialType)
                {
                    case DMethod.MethodType.Constructor:
                        sb.Append("Constructor");
                        name = dm.Parent.Name;
                        break;
                    case DMethod.MethodType.Destructor:
                        sb.Append("Destructor"); name = dm.Parent.Name;
                        break;
                    case DMethod.MethodType.Allocator:
                        sb.Append("Allocator"); name = dm.Parent.Name;
                        break;
                    default:
                        sb.Append("Method");
                        name = dm.Name;
                        break;
                }
                sb.Append(")</i> ");

                if (dm.Type != null)
                {
                    sb.Append(dm.Type.ToString(true));
                    sb.Append(" ");
                }
                else if (dm.Attributes != null && dm.Attributes.Count != 0)
                {
                    foreach (var attr in dm.Attributes)
                    {
                        var m = attr as Modifier;
                        if (m != null && DTokens.StorageClass[m.Token])
                        {
                            sb.Append(DTokens.GetTokenString(m.Token));
                            sb.Append(" ");
                            break;
                        }
                    }
                }

                sb.Append(name);

                /*TODO: Show attributes?
                if (dm.Attributes != null && dm.Attributes.Count > 0)
                    s = dm.AttributeString + ' ';
                */

                // Template parameters
                if (dm.TemplateParameters != null && dm.TemplateParameters.Length > 0)
                {
                    sb.Append("(");

                    for (int i = 0;i < dm.TemplateParameters.Length; i++)
                    {
                        var p= dm.TemplateParameters[i];
                        if (args.IsTemplateInstanceArguments && i == currentParameter)
                        {
                            sb.Append("<u>");
                            tti.AddCategory(p.Name, p.ToString());
                            sb.Append(p.ToString());
                            sb.Append("</u>");
                        }
                        else
                            sb.Append(p.ToString());

                        if (i < dm.TemplateParameters.Length - 1)
                            sb.Append(",");
                    }

                    sb.Append(")");
                }

                // Parameters
                sb.Append("(");

                for (int i = 0; i < dm.Parameters.Count; i++)
                {
                    var p = dm.Parameters[i] as DNode;
                    if (!args.IsTemplateInstanceArguments && i == currentParameter)
                    {
                        sb.Append("<u>");
                        if(!string.IsNullOrEmpty(p.Description))
                            tti.AddCategory(p.Name, p.Description);
                        sb.Append(p.ToString(true,false));
                        sb.Append("</u>");
                    }
                    else
//.........这里部分代码省略.........
开发者ID:rikkimax,项目名称:Mono-D,代码行数:101,代码来源:DParameterDataProvider.cs

示例4: GetKeywordTooltip

		public TooltipInformation GetKeywordTooltip (SyntaxToken node)
		{
			var result = new TooltipInformation ();

			var color = AlphaBlend (colorStyle.PlainText.Foreground, colorStyle.PlainText.Background, optionalAlpha);
			var colorString = MonoDevelop.Components.HelperMethods.GetColorString (color);

			var keywordSign = "<span foreground=\"" + colorString + "\"> " + GettextCatalog.GetString ("(keyword)") + "</span>";

			switch (node.Kind ()) {
			case SyntaxKind.AbstractKeyword:
				result.SignatureMarkup = Highlight ("abstract", colorStyle.KeywordModifiers) + keywordSign;
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} modifier can be used with classes, methods, properties, indexers, and events.", Highlight ("abstract", colorStyle.KeywordModifiers));
				break;
			case SyntaxKind.AddKeyword:
				result.SignatureMarkup = Highlight ("add", colorStyle.KeywordContext) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), GettextCatalog.GetString ("[modifiers] {0} {{ accessor-body }}", Highlight ("add", colorStyle.KeywordContext)));
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} keyword is used to define a custom accessor for when an event is subscribed to. If supplied, a remove accessor must also be supplied.", Highlight ("add", colorStyle.KeywordContext));
				break;
			case SyntaxKind.AscendingKeyword:
				result.SignatureMarkup = Highlight ("ascending", colorStyle.KeywordContext) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Query Form"), GettextCatalog.GetString ("{0} ordering-statement {1}", Highlight ("orderby", colorStyle.KeywordContext), Highlight ("ascending", colorStyle.KeywordContext)));
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} keyword is used to set the sorting order from smallest to largest in a query expression. This is the default behaviour.", Highlight ("ascending", colorStyle.KeywordContext));
				break;
			case SyntaxKind.AsyncKeyword:
				result.SignatureMarkup = Highlight ("async", colorStyle.KeywordContext) + keywordSign;
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} modifier is used to specify that a class method, anonymous method, or lambda expression is asynchronous.", Highlight ("async", colorStyle.KeywordContext));
				break;
			case SyntaxKind.AsKeyword:
				result.SignatureMarkup = Highlight ("as", colorStyle.KeywordOperators) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), GettextCatalog.GetString ("expression {0} type", Highlight ("as", colorStyle.KeywordOperators)));
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} operator is used to perform conversions between compatible types.", Highlight ("as", colorStyle.KeywordOperators));
				break;
			case SyntaxKind.AwaitKeyword:
				result.SignatureMarkup = Highlight ("await", colorStyle.KeywordContext) + keywordSign;
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} operator is used to specify that an {1} method is to have its execution suspended until the {0} task has completed.", Highlight ("await", colorStyle.KeywordContext), Highlight ("async", colorStyle.KeywordContext));
				break;
			case SyntaxKind.BaseKeyword:
				result.SignatureMarkup = Highlight ("base", colorStyle.KeywordAccessors) + keywordSign;
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} keyword is used to access members of the base class from within a derived class.", Highlight ("base", colorStyle.KeywordAccessors));
				break;
			case SyntaxKind.BreakKeyword:
				result.SignatureMarkup = Highlight ("break", colorStyle.KeywordJump) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), Highlight ("break", colorStyle.KeywordJump) + ";");
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} statement terminates the closest enclosing loop or switch statement in which it appears.", Highlight ("break", colorStyle.KeywordJump));
				break;
			case SyntaxKind.CaseKeyword:
				result.SignatureMarkup = Highlight ("case", colorStyle.KeywordSelection) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), 
				                    GettextCatalog.GetString ("{0} constant-expression:\n  statement\n  jump-statement", Highlight ("case", colorStyle.KeywordSelection)));
				result.SummaryMarkup = "";
				break;
			case SyntaxKind.CatchKeyword:
				result.SignatureMarkup = Highlight ("catch", colorStyle.KeywordException) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), GettextCatalog.GetString ("{0} try-block\n  {1} (exception-declaration-1) catch-block-1\n  {1} (exception-declaration-2) catch-block-2\n  ...\n{0} try-block {1} catch-block", Highlight ("try", colorStyle.KeywordException), Highlight ("catch", colorStyle.KeywordException)));
				result.SummaryMarkup = "";
				break;
			case SyntaxKind.CheckedKeyword:
				result.SignatureMarkup = Highlight ("checked", colorStyle.KeywordOther) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), GettextCatalog.GetString ("{0} block\nor\n{0} (expression)", Highlight ("checked", colorStyle.KeywordOther)));
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} keyword is used to control the overflow-checking context for integral-type arithmetic operations and conversions. It can be used as an operator or a statement.", Highlight ("checked", colorStyle.KeywordOther));
				break;
			case SyntaxKind.ClassKeyword:
				result.SignatureMarkup = Highlight ("class", colorStyle.KeywordDeclaration) + keywordSign;
				if (node.Parent != null && node.Parent.IsKind (SyntaxKind.ConstructorConstraint)) {
					result.SummaryMarkup = GettextCatalog.GetString ("The {0} constraint specifies that the type argument must be a reference type; this applies also to any class, interface, delegate, or array type.", Highlight ("class", colorStyle.KeywordDeclaration));
				} else {
					result.AddCategory (GettextCatalog.GetString ("Form"), GettextCatalog.GetString ("[attributes] [modifiers] {0} identifier [:base-list] {{ class-body }}[;]", Highlight ("class", colorStyle.KeywordDeclaration)));
					result.SummaryMarkup = GettextCatalog.GetString ("Classes are declared using the keyword {0}.", Highlight ("class", colorStyle.KeywordDeclaration));
				}
				break;
			case SyntaxKind.ConstKeyword:
				result.SignatureMarkup = Highlight ("const", colorStyle.KeywordModifiers) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), GettextCatalog.GetString ("[attributes] [modifiers] {0} type declarators;", Highlight ("const", colorStyle.KeywordModifiers)));
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} keyword is used to modify a declaration of a field or local variable. It specifies that the value of the field or the local variable cannot be modified.", Highlight ("const", colorStyle.KeywordModifiers));
				break;
			case SyntaxKind.ContinueKeyword:
				result.SignatureMarkup = Highlight ("continue", colorStyle.KeywordJump) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), Highlight ("continue", colorStyle.KeywordJump) + ";");
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} statement passes control to the next iteration of the enclosing iteration statement in which it appears.", Highlight ("continue", colorStyle.KeywordJump));
				break;
			case SyntaxKind.DefaultKeyword:
				result.SignatureMarkup = Highlight ("default", colorStyle.KeywordSelection) + keywordSign;
				result.SummaryMarkup = "";
				if (node.Parent != null) {
					if (node.Parent is DefaultExpressionSyntax) {
						result.AddCategory (GettextCatalog.GetString ("Form"),
						                    GettextCatalog.GetString ("{0} (Type)", Highlight ("default", colorStyle.KeywordSelection)));
						break;
					} else if (node.Parent is SwitchStatementSyntax) {
						result.AddCategory (GettextCatalog.GetString ("Form"),
						                    GettextCatalog.GetString ("{0} (expression) { \n  {1} constant-expression:\n    statement\n    jump-statement\n  [{2}:\n    statement\n    jump-statement]\n}",
						                    Highlight ("switch", colorStyle.KeywordSelection), Highlight ("case", colorStyle.KeywordSelection), Highlight ("default", colorStyle.KeywordSelection)));
						break;
					}
				}
				result.AddCategory (GettextCatalog.GetString ("Form"),
						            GettextCatalog.GetString ("{0} (Type)\n\nor\n\n{1} (expression) { \n  {2} constant-expression:\n    statement\n    jump-statement\n  [{3}:\n    statement\n    jump-statement]\n}", 
						                                      Highlight ("default", colorStyle.KeywordSelection), Highlight ("switch", colorStyle.KeywordSelection), Highlight ("case", colorStyle.KeywordSelection), Highlight ("default", colorStyle.KeywordSelection))
						           );
//.........这里部分代码省略.........
开发者ID:kdubau,项目名称:monodevelop,代码行数:101,代码来源:SignatureMarkupCreator.cs

示例5: GetExternAliasTooltip

		public TooltipInformation GetExternAliasTooltip (ExternAliasDirectiveSyntax externAliasDeclaration, DotNetProject project)
		{
			var result = new TooltipInformation ();
			result.SignatureMarkup = Highlight ("extern ", colorStyle.KeywordModifiers) + Highlight ("alias ", colorStyle.KeywordNamespace) + externAliasDeclaration.Identifier;
			if (project == null)
				return result;
			foreach (var r in project.References) {
				if (string.IsNullOrEmpty (r.Aliases))
					continue;
				foreach (var alias in r.Aliases.Split (',', ';')) {
					if (alias == externAliasDeclaration.Identifier.ToFullString ())
						result.AddCategory (GettextCatalog.GetString ("Reference"), r.StoredReference);
				}
			}

			return result;
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:17,代码来源:SignatureMarkupCreator.cs

示例6: GetConstraintTooltip

		public TooltipInformation GetConstraintTooltip (SyntaxToken keyword)
		{
			var result = new TooltipInformation ();

			var color = AlphaBlend (colorStyle.PlainText.Foreground, colorStyle.PlainText.Background, optionalAlpha);
			var colorString = MonoDevelop.Components.HelperMethods.GetColorString (color);

			var keywordSign = "<span foreground=\"" + colorString + "\"> " + GettextCatalog.GetString ("(keyword)") + "</span>";

			result.SignatureMarkup = Highlight (keyword.ToFullString (), colorStyle.KeywordTypes) + keywordSign;

			switch (keyword.Parent.Kind ()) {
			case SyntaxKind.ClassConstraint:
				result.AddCategory (GettextCatalog.GetString ("Constraint"), GettextCatalog.GetString ("The type argument must be a reference type; this applies also to any class, interface, delegate, or array type."));
				break;
			case SyntaxKind.ConstructorConstraint:
				result.AddCategory (GettextCatalog.GetString ("Constraint"), GettextCatalog.GetString ("The type argument must have a public parameterless constructor. When used together with other constraints, the new() constraint must be specified last."));
				break;
			case SyntaxKind.StructConstraint:
				result.AddCategory (GettextCatalog.GetString ("Constraint"), GettextCatalog.GetString ("The type argument must be a value type. Any value type except Nullable can be specified. See Using Nullable Types (C# Programming Guide) for more information."));
				break;
			}

			return result;
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:25,代码来源:SignatureMarkupCreator.cs

示例7: GetKeywordTooltip

		public TooltipInformation GetKeywordTooltip (string keyword, AstNode hintNode)
		{
			var result = new TooltipInformation ();

			var color = AlphaBlend (colorStyle.PlainText.Foreground, colorStyle.PlainText.Background, optionalAlpha);
			var colorString = Mono.TextEditor.HelperMethods.GetColorString (color);
			
			var keywordSign = "<span foreground=\"" + colorString + "\">" + " (keyword)</span>";

			switch (keyword){
			case "abstract":
				result.SignatureMarkup = Highlight ("abstract", colorStyle.KeywordModifiers) + keywordSign;
				result.SummaryMarkup = "The " + Highlight ("abstract", colorStyle.KeywordModifiers) + " modifier can be used with classes, methods, properties, indexers, and events.";
				break;
			case "add":
				result.SignatureMarkup = Highlight ("add", colorStyle.KeywordContext) + keywordSign;
                result.AddCategory("Form", "[modifiers] " + Highlight("add", colorStyle.KeywordContext) + " { accessor-body }");
                result.SummaryMarkup = "The " + Highlight("add", colorStyle.KeywordContext) + " keyword is used to define a custom accessor for when an event is subscribed to. If supplied, a remove accessor must also be supplied.";
				break;
			case "ascending":
				result.SignatureMarkup = Highlight ("ascending", colorStyle.KeywordContext) + keywordSign;
                result.AddCategory("Query Form", Highlight("orderby", colorStyle.KeywordContext) + " ordering-statement " + Highlight("ascending", colorStyle.KeywordContext));
                result.SummaryMarkup = "The " + Highlight("ascending", colorStyle.KeywordContext) + " keyword is used to set the sorting order from smallest to largest in a query expression. This is the default behaviour.";
				break;
			case "async":
				result.SignatureMarkup = Highlight ("async", colorStyle.KeywordContext) + keywordSign;
                result.SummaryMarkup = "The " + Highlight("async", colorStyle.KeywordContext) + " modifier is used to specify that a class method, anonymous method, or lambda expression is asynchronous.";
				break;
			case "as":
				result.SignatureMarkup = Highlight ("as", colorStyle.KeywordOperators) + keywordSign;
				result.AddCategory ("Form", "expression " + Highlight ("as", colorStyle.KeywordOperators) + " type");
				result.SummaryMarkup = "The " + Highlight ("as", colorStyle.KeywordOperators) + " operator is used to perform conversions between compatible types. ";
				break;
			case "await":
				result.SignatureMarkup = Highlight ("await", colorStyle.KeywordContext) + keywordSign;
                result.SummaryMarkup = "The " + Highlight("await", colorStyle.KeywordContext) + " operator is used to specify that an " + Highlight("async", colorStyle.KeywordContext) + " method is to have its execution suspended until the " + Highlight("await", colorStyle.KeywordContext) +
                    " task has completed.";
				break;
			case "base":
				result.SignatureMarkup = Highlight ("base", colorStyle.KeywordAccessors) + keywordSign;
				result.SummaryMarkup = "The " + Highlight ("base", colorStyle.KeywordAccessors) + " keyword is used to access members of the base class from within a derived class.";
				break;
			case "break":
				result.SignatureMarkup = Highlight ("break", colorStyle.KeywordJump) + keywordSign;
				result.AddCategory ("Form", Highlight ("break", colorStyle.KeywordJump) + ";");
				result.SummaryMarkup = "The " + Highlight ("break", colorStyle.KeywordJump) + " statement terminates the closest enclosing loop or switch statement in which it appears.";
				break;
			case "case":
				result.SignatureMarkup = Highlight ("case", colorStyle.KeywordSelection) + keywordSign;
				result.AddCategory ("Form", Highlight ("case", colorStyle.KeywordSelection) + " constant-expression:" + Environment.NewLine +
				                    "  statement" + Environment.NewLine +
				                    "  jump-statement");
				result.SummaryMarkup = "";
				break;
			case "catch":
				result.SignatureMarkup = Highlight ("catch", colorStyle.KeywordException) + keywordSign;
				result.AddCategory ("Form", Highlight ("try", colorStyle.KeywordException) + " try-block" + Environment.NewLine +
				                    "  " + Highlight ("catch", colorStyle.KeywordException) + " (exception-declaration-1) catch-block-1" + Environment.NewLine +
				                    "  " + Highlight ("catch", colorStyle.KeywordException) + " (exception-declaration-2) catch-block-2" + Environment.NewLine +
				                    "  ..." + Environment.NewLine +
				                    Highlight ("try", colorStyle.KeywordException) + " try-block " + Highlight ("catch", colorStyle.KeywordException) + " catch-block");
				result.SummaryMarkup = "";
				break;
			case "checked":
				result.SignatureMarkup = Highlight ("checked", colorStyle.KeywordOther) + keywordSign;
				result.AddCategory ("Form", Highlight ("checked", colorStyle.KeywordOther) + " block" + Environment.NewLine +
				                    "or" + Environment.NewLine +
				                    Highlight ("checked", colorStyle.KeywordOther) + " (expression)");
				result.SummaryMarkup = "The " + Highlight ("checked", colorStyle.KeywordOther) + " keyword is used to control the overflow-checking context for integral-type arithmetic operations and conversions. It can be used as an operator or a statement.";
				break;
			case "class":
				result.SignatureMarkup = Highlight ("class", colorStyle.KeywordDeclaration) + keywordSign;
				result.AddCategory ("Form", "[attributes] [modifiers] " + Highlight ("class", colorStyle.KeywordDeclaration) + " identifier [:base-list] { class-body }[;]");
				result.SummaryMarkup = "Classes are declared using the keyword " + Highlight ("class", colorStyle.KeywordDeclaration) + ".";
				break;
			case "const":
				result.SignatureMarkup = Highlight ("const", colorStyle.KeywordModifiers) + keywordSign;
				result.AddCategory ("Form", "[attributes] [modifiers] " + Highlight ("const", colorStyle.KeywordModifiers) + " type declarators;");
				result.SummaryMarkup = "The " + Highlight ("const", colorStyle.KeywordModifiers) + " keyword is used to modify a declaration of a field or local variable. It specifies that the value of the field or the local variable cannot be modified. ";
				break;
			case "continue":
				result.SignatureMarkup = Highlight ("continue", colorStyle.KeywordJump) + keywordSign;
				result.AddCategory ("Form", Highlight ("continue", colorStyle.KeywordJump) + ";");
				result.SummaryMarkup = "The " + Highlight ("continue", colorStyle.KeywordJump) + " statement passes control to the next iteration of the enclosing iteration statement in which it appears.";
				break;
			case "default":
				result.SignatureMarkup = Highlight ("default", colorStyle.KeywordSelection) + keywordSign;
				result.SummaryMarkup = "";
				if (hintNode != null) {
					if (hintNode.Parent is DefaultValueExpression) {
						result.AddCategory ("Form",
						                    Highlight ("default", colorStyle.KeywordSelection) + " (Type)");
						break;
					} else if (hintNode.Parent is CaseLabel) {
						result.AddCategory ("Form",
						                    Highlight ("switch", colorStyle.KeywordSelection) + " (expression) { "+ Environment.NewLine +
						                    "  " + Highlight ("case", colorStyle.KeywordSelection) + " constant-expression:" + Environment.NewLine +
						                    "    statement"+ Environment.NewLine +
						                    "    jump-statement" + Environment.NewLine +
						                    "  [" + Highlight ("default", colorStyle.KeywordSelection) + ":" + Environment.NewLine +
//.........这里部分代码省略.........
开发者ID:Chertolom,项目名称:monodevelop,代码行数:101,代码来源:SignatureMarkupCreator.cs

示例8: GetAliasedTypeTooltip

		public TooltipInformation GetAliasedTypeTooltip (AliasTypeResolveResult resolveResult)
		{
			var result = new TooltipInformation ();
			result.SignatureMarkup = GetTypeMarkup (resolveResult.Type, true);
			result.AddCategory (GettextCatalog.GetString ("Alias information"), GettextCatalog.GetString ("Resolved using alias '{0}'", resolveResult.Alias));
			return result;
		}
开发者ID:Chertolom,项目名称:monodevelop,代码行数:7,代码来源:SignatureMarkupCreator.cs

示例9: GetConstraintTooltip

		public TooltipInformation GetConstraintTooltip (string keyword)
		{
			var result = new TooltipInformation ();

			var color = AlphaBlend (colorStyle.PlainText.Foreground, colorStyle.PlainText.Background, optionalAlpha);
			var colorString = Mono.TextEditor.HelperMethods.GetColorString (color);
			
			var keywordSign = "<span foreground=\"" + colorString + "\">" + " (keyword)</span>";

			result.SignatureMarkup = Highlight (keyword, colorStyle.KeywordTypes) + keywordSign;

			switch (keyword) {
			case "class":
				result.AddCategory ("Constraint", "The type argument must be a reference type; this applies also to any class, interface, delegate, or array type.");
				break;
			case "new":
				result.AddCategory ("Constraint", "The type argument must have a public parameterless constructor. When used together with other constraints, the new() constraint must be specified last.");
				break;
			case "struct":
				result.AddCategory ("Constraint", "The type argument must be a value type. Any value type except Nullable can be specified. See Using Nullable Types (C# Programming Guide) for more information.");
				break;
			}

			return result;
		}
开发者ID:Chertolom,项目名称:monodevelop,代码行数:25,代码来源:SignatureMarkupCreator.cs

示例10: CreateTooltipInformation

		public static Task<TooltipInformation> CreateTooltipInformation (CancellationToken ctoken, MonoDevelop.Ide.Editor.TextEditor editor, MonoDevelop.Ide.Editor.DocumentContext ctx, ISymbol entity, bool smartWrap, bool createFooter = false, SemanticModel model = null)
		{
			var tooltipInfo = new TooltipInformation ();
//			if (resolver == null)
//				resolver = file != null ? file.GetResolver (compilation, textEditorData.Caret.Location) : new CSharpResolver (compilation);
			var sig = new SignatureMarkupCreator (ctx, editor != null ? editor.CaretOffset : 0);
			sig.SemanticModel = model;
			sig.BreakLineAfterReturnType = smartWrap;

			return Task.Run (() => {
				if (ctoken.IsCancellationRequested)
					return null;
				try {
					tooltipInfo.SignatureMarkup = sig.GetMarkup (entity);
				} catch (Exception e) {
					LoggingService.LogError ("Got exception while creating markup for :" + entity, e);
					return new TooltipInformation ();
				}

				if (ctoken.IsCancellationRequested)
					return null;
				
				tooltipInfo.SummaryMarkup = Ambience.GetSummaryMarkup (entity) ?? "";

				//			if (entity is IMember) {
				//				var evt = (IMember)entity;
				//				if (evt.ReturnType.Kind == TypeKind.Delegate) {
				//					tooltipInfo.AddCategory (GettextCatalog.GetString ("Delegate Info"), sig.GetDelegateInfo (evt.ReturnType));
				//				}
				//			}
				if (entity is IMethodSymbol) {
					var method = (IMethodSymbol)entity;
					if (method.IsExtensionMethod) {
						tooltipInfo.AddCategory (GettextCatalog.GetString ("Extension Method from"), method.ContainingType.Name);
					}
				}
				if (createFooter) {
					tooltipInfo.FooterMarkup = sig.CreateFooter (entity);
				}
				return tooltipInfo;
			});
		}
开发者ID:pjcollins,项目名称:monodevelop,代码行数:42,代码来源:RoslynSymbolCompletionData.cs

示例11: CreateTooltipInformation

		public static TooltipInformation CreateTooltipInformation (ICompilation compilation, CSharpUnresolvedFile file, TextEditorData textEditorData, MonoDevelop.CSharp.Formatting.CSharpFormattingPolicy formattingPolicy, IParameterizedMember entity, int currentParameter, bool smartWrap)
		{
			var tooltipInfo = new TooltipInformation ();
			var resolver = file.GetResolver (compilation, textEditorData.Caret.Location);
			var sig = new SignatureMarkupCreator (resolver, formattingPolicy.CreateOptions ());
			sig.HighlightParameter = currentParameter;
			sig.BreakLineAfterReturnType = smartWrap;
			try {
				tooltipInfo.SignatureMarkup = sig.GetMarkup (entity);
			} catch (Exception e) {
				LoggingService.LogError ("Got exception while creating markup for :" + entity, e);
				return new TooltipInformation ();
			}
			tooltipInfo.SummaryMarkup = AmbienceService.GetSummaryMarkup (entity) ?? "";
			
			if (entity is IMethod) {
				var method = (IMethod)entity;
				if (method.IsExtensionMethod) {
					tooltipInfo.AddCategory (GettextCatalog.GetString ("Extension Method from"), method.DeclaringTypeDefinition.FullName);
				}
			}
			int paramIndex = currentParameter;

			if (entity is IMethod && ((IMethod)entity).IsExtensionMethod)
				paramIndex++;
			paramIndex = Math.Min (entity.Parameters.Count - 1, paramIndex);

			var curParameter = paramIndex >= 0  && paramIndex < entity.Parameters.Count ? entity.Parameters [paramIndex] : null;
			if (curParameter != null) {

				string docText = AmbienceService.GetDocumentation (entity);
				if (!string.IsNullOrEmpty (docText)) {
					string text = docText;
					Regex paramRegex = new Regex ("(\\<param\\s+name\\s*=\\s*\"" + curParameter.Name + "\"\\s*\\>.*?\\</param\\>)", RegexOptions.Compiled);
					Match match = paramRegex.Match (docText);
					
					if (match.Success) {
						text = AmbienceService.GetDocumentationMarkup (entity, match.Groups [1].Value);
						if (!string.IsNullOrWhiteSpace (text))
							tooltipInfo.AddCategory (GettextCatalog.GetString ("Parameter"), text);
					}
				}
		
				if (curParameter.Type.Kind == TypeKind.Delegate)
					tooltipInfo.AddCategory (GettextCatalog.GetString ("Delegate Info"), sig.GetDelegateInfo (curParameter.Type));
			}
			return tooltipInfo;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:48,代码来源:MethodParameterDataProvider.cs

示例12: Generate

        public static TooltipInformation Generate(DMethod dm, bool isTemplateParamInsight=false, int currentParam=-1)
        {
            var tti = new TooltipInformation();
            var sb = new StringBuilder("<i>(");

            string name;
            switch (dm.SpecialType)
            {
                case DMethod.MethodType.Constructor:
                    sb.Append("Constructor");
                    name = dm.Parent.Name;
                    break;
                case DMethod.MethodType.Destructor:
                    sb.Append("Destructor"); name = dm.Parent.Name;
                    break;
                case DMethod.MethodType.Allocator:
                    sb.Append("Allocator"); name = dm.Parent.Name;
                    break;
                default:
                    sb.Append("Method");
                    name = dm.Name;
                    break;
            }
            sb.Append(")</i> ");

            if (dm.Type != null)
            {
                sb.Append(dm.Type.ToString(true));
                sb.Append(" ");
            }
            else if (dm.Attributes != null && dm.Attributes.Count != 0)
            {
                foreach (var attr in dm.Attributes)
                {
                    var m = attr as Modifier;
                    if (m != null && DTokens.StorageClass[m.Token])
                    {
                        sb.Append(DTokens.GetTokenString(m.Token));
                        sb.Append(" ");
                        break;
                    }
                }
            }

            sb.Append(name);

            /*TODO: Show attributes?
            if (dm.Attributes != null && dm.Attributes.Count > 0)
                s = dm.AttributeString + ' ';
            */

            // Template parameters
            if (dm.TemplateParameters != null && dm.TemplateParameters.Length > 0)
            {
                sb.Append("(");

                for (int i = 0; i < dm.TemplateParameters.Length; i++)
                {
                    var p = dm.TemplateParameters[i];
                    if (isTemplateParamInsight && i == currentParam)
                    {
                        sb.Append("<u>");
                        tti.AddCategory(p.Name, p.ToString());
                        sb.Append(p.ToString());
                        sb.Append("</u>");
                    }
                    else
                        sb.Append(p.ToString());

                    if (i < dm.TemplateParameters.Length - 1)
                        sb.Append(",");
                }

                sb.Append(")");
            }

            // Parameters
            sb.Append("(");

            for (int i = 0; i < dm.Parameters.Count; i++)
            {
                var p = dm.Parameters[i] as DNode;
                if (!isTemplateParamInsight && i == currentParam)
                {
                    sb.Append("<u>");
                    if (!string.IsNullOrEmpty(p.Description))
                        tti.AddCategory(p.Name, p.Description);
                    sb.Append(p.ToString(true, false));
                    sb.Append("</u>");
                }
                else
                    sb.Append(p.ToString(true, false));

                if (i < dm.Parameters.Count - 1)
                    sb.Append(",");
            }

            sb.Append(")");
            tti.SignatureMarkup = sb.ToString();

//.........这里部分代码省略.........
开发者ID:simendsjo,项目名称:Mono-D,代码行数:101,代码来源:TooltipInfoGenerator.cs

示例13: CreateTooltipInformation

 public virtual TooltipInformation CreateTooltipInformation(bool smartWrap)
 {
     var tt = new TooltipInformation ();
     if (!string.IsNullOrEmpty (Description))
         tt.AddCategory (null, Description);
     return tt;
 }
开发者ID:brantwedel,项目名称:monodevelop,代码行数:7,代码来源:CompletionData.cs

示例14: CreateTooltipInformation

			internal static Task<TooltipInformation> CreateTooltipInformation (MonoDevelop.Ide.Editor.TextEditor editor, MonoDevelop.Ide.Editor.DocumentContext ctx, ISymbol sym, int currentParameter, bool smartWrap, CancellationToken cancelToken)
			{
				var tooltipInfo = new TooltipInformation ();
				var sig = new SignatureMarkupCreator (ctx, editor != null ? editor.CaretOffset : 0);
				sig.HighlightParameter = currentParameter;
				sig.BreakLineAfterReturnType = smartWrap;

				return Task.Run (() => {
					if (cancelToken.IsCancellationRequested)
						return null;
					try {
						tooltipInfo.SignatureMarkup = sig.GetMarkup (sym);
					} catch (Exception e) {
						LoggingService.LogError ("Got exception while creating markup for :" + sym, e);
						return new TooltipInformation ();
					}
					tooltipInfo.SummaryMarkup = Ambience.GetSummaryMarkup (sym) ?? "";

					if (cancelToken.IsCancellationRequested)
						return null;
					
					if (sym is IMethodSymbol) {
						var method = (IMethodSymbol)sym;
						if (method.IsExtensionMethod && method.ReducedFrom != null && method.ReducedFrom.ContainingType != null) {
							tooltipInfo.AddCategory (GettextCatalog.GetString ("Extension Method from"), method.ReducedFrom.ContainingType.Name);
						}
					}
					int paramIndex = currentParameter;

					//				if (Symbol is IMethodSymbol && ((IMethodSymbol)Symbol).IsExtensionMethod)
					//					paramIndex++;
					var list = GetParameterList (sym);
					paramIndex = Math.Min (list.Length - 1, paramIndex);

					var curParameter = paramIndex >= 0 && paramIndex < list.Length ? list [paramIndex] : null;
					if (curParameter != null) {

						string docText = Ambience.GetDocumentation (sym);
						if (!string.IsNullOrEmpty (docText)) {
							string text = docText;
							Regex paramRegex = new Regex ("(\\<param\\s+name\\s*=\\s*\"" + curParameter.Name + "\"\\s*\\>.*?\\</param\\>)", RegexOptions.Compiled);
							Match match = paramRegex.Match (docText);

							if (match.Success) {
								text = Ambience.GetDocumentationMarkup (sym, match.Groups [1].Value);
								if (!string.IsNullOrWhiteSpace (text))
									tooltipInfo.AddCategory (GettextCatalog.GetString ("Parameter"), text);
							}
						}
						if (curParameter.Type.TypeKind == TypeKind.Delegate)
							tooltipInfo.AddCategory (GettextCatalog.GetString ("Delegate Info"), sig.GetDelegateInfo (curParameter.Type));
					}
					return tooltipInfo;
				});
			}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:55,代码来源:RoslynParameterHintingFactory.cs

示例15: RenderParamtersAndFooters

        static void RenderParamtersAndFooters(TooltipInformation tti,DMethod dm, StringBuilder sb, bool isTemplateParamInsight, int currentParam = -1)
        {
            // Template parameters
            if (dm.TemplateParameters != null && dm.TemplateParameters.Length > 0)
            {
                sb.Append("(");

                for (int i = 0; i < dm.TemplateParameters.Length; i++)
                {
                    var p = dm.TemplateParameters[i];
                    if (isTemplateParamInsight && i == currentParam)
                    {
                        sb.Append("<u>");
                        tti.AddCategory(p.Name, p.ToString());
                        sb.Append(p.ToString());
                        sb.Append("</u>");
                    }
                    else
                        sb.Append(p.ToString());

                    if (i < dm.TemplateParameters.Length - 1)
                        sb.Append(",");
                }

                sb.Append(")");
            }

            // Parameters
            sb.Append("(");

            for (int i = 0; i < dm.Parameters.Count; i++)
            {
                var p = dm.Parameters[i] as DNode;
                if (!isTemplateParamInsight && i == currentParam)
                {
                    sb.Append("<u>");
                    if (!string.IsNullOrEmpty(p.Description))
                        tti.AddCategory(p.Name, p.Description);
                    sb.Append(p.ToString(true, false));
                    sb.Append("</u>");
                }
                else
                    sb.Append(p.ToString(true, false));

                if (i < dm.Parameters.Count - 1)
                    sb.Append(",");
            }

            sb.Append(")");
            tti.SignatureMarkup = sb.ToString();

            tti.SummaryMarkup = dm.Description;
            tti.FooterMarkup = dm.ToString();
        }
开发者ID:Geod24,项目名称:Mono-D,代码行数:54,代码来源:TooltipInfoGenerator.cs


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