Example #1
0
		public static FlowDocument CreateTooltip(IType type, bool useFullyQualifiedMemberNames = true)
		{
			var ambience = AmbienceService.GetCurrentAmbience();
			ambience.ConversionFlags = ConversionFlags.StandardConversionFlags | ConversionFlags.ShowDeclaringType;
			if (useFullyQualifiedMemberNames)
				ambience.ConversionFlags |= ConversionFlags.UseFullyQualifiedMemberNames;
			string header;
			if (type is ITypeDefinition)
				header = ambience.ConvertEntity((ITypeDefinition)type);
			else
				header = ambience.ConvertType(type);
			
			ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList;
			DocumentationUIBuilder b = new DocumentationUIBuilder(ambience);
			b.AddCodeBlock(header, keepLargeMargin: true);
			
			ITypeDefinition entity = type.GetDefinition();
			if (entity != null) {
				var documentation = XmlDocumentationElement.Get(entity);
				if (documentation != null) {
					foreach (var child in documentation.Children) {
						b.AddDocumentationElement(child);
					}
				}
			}
			return b.CreateFlowDocument();
		}
        public static FlowDocument CreateTooltip(IEntity entity, bool useFullyQualifiedMemberNames = true)
        {
            var ambience = AmbienceService.GetCurrentAmbience();

            ambience.ConversionFlags = ConversionFlags.StandardConversionFlags | ConversionFlags.ShowDeclaringType;
            if (useFullyQualifiedMemberNames)
            {
                ambience.ConversionFlags |= ConversionFlags.UseFullyQualifiedEntityNames;
            }
            string header        = ambience.ConvertSymbol(entity);
            var    documentation = XmlDocumentationElement.Get(entity);

            ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList;
            DocumentationUIBuilder b = new DocumentationUIBuilder(ambience);

            b.AddCodeBlock(header, keepLargeMargin: true);
            if (documentation != null)
            {
                foreach (var child in documentation.Children)
                {
                    b.AddDocumentationElement(child);
                }
            }
            return(b.CreateFlowDocument());
        }
Example #3
0
		public static FlowDocument CreateTooltip(IEntity entity)
		{
			var ambience = AmbienceService.GetCurrentAmbience();
			ambience.ConversionFlags = ConversionFlags.StandardConversionFlags | ConversionFlags.ShowDeclaringType | ConversionFlags.UseFullyQualifiedMemberNames;
			string header = ambience.ConvertEntity(entity);
			var documentation = XmlDocumentationElement.Get(entity);
			
			ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList;
			DocumentationUIBuilder b = new DocumentationUIBuilder(ambience);
			b.AddCodeBlock(header, keepLargeMargin: true);
			if (documentation != null) {
				foreach (var child in documentation.Children) {
					b.AddDocumentationElement(child);
				}
			}
			return b.CreateFlowDocument();
		}
Example #4
0
		FlowDocumentScrollViewer GenerateHeader()
		{
			CSharpAmbience ambience = new CSharpAmbience();
			ambience.ConversionFlags = ConversionFlags.StandardConversionFlags;
			var stringBuilder = new StringBuilder();
			var formatter = new ParameterHighlightingOutputFormatter(stringBuilder, highlightedParameterIndex);
			ambience.ConvertEntity(Method, formatter, FormattingOptionsFactory.CreateSharpDevelop());
			
			var documentation = XmlDocumentationElement.Get(Method);
			ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList;
			
			DocumentationUIBuilder b = new DocumentationUIBuilder(ambience);
			string parameterName = null;
			if (Method.Parameters.Count > highlightedParameterIndex)
				parameterName = Method.Parameters[highlightedParameterIndex].Name;
			b.AddSignatureBlock(stringBuilder.ToString(), formatter.parameterStartOffset, formatter.parameterLength, parameterName);
			
			DocumentationUIBuilder b2 = new DocumentationUIBuilder(ambience);
			b2.ParameterName = parameterName;
			b2.ShowAllParameters = false;
			
			if (documentation != null) {
				foreach (var child in documentation.Children) {
					b2.AddDocumentationElement(child);
				}
			}
			
			content = new FlowDocumentScrollViewer {
				Document = b2.CreateFlowDocument(),
				VerticalScrollBarVisibility = ScrollBarVisibility.Auto
			};
			
			var flowDocument = b.CreateFlowDocument();
			flowDocument.PagePadding = new Thickness(0); // default is NOT Thickness(0), but Thickness(Auto), which adds unnecessary space
			
			return new FlowDocumentScrollViewer {
				Document = flowDocument,
				VerticalScrollBarVisibility = ScrollBarVisibility.Auto
			};
		}
        public static FlowDocument CreateTooltip(ISymbol symbol)
        {
            var ambience = AmbienceService.GetCurrentAmbience();

            ambience.ConversionFlags = ConversionFlags.StandardConversionFlags | ConversionFlags.ShowDeclaringType;
            string header = ambience.ConvertSymbol(symbol);

            if (symbol is IParameter)
            {
                header = "parameter " + header;
            }
            else if (symbol is IVariable)
            {
                header = "local variable " + header;
            }

            ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList;
            DocumentationUIBuilder b = new DocumentationUIBuilder(ambience);

            b.AddCodeBlock(header, keepLargeMargin: true);
            return(b.CreateFlowDocument());
        }
        public static FlowDocument CreateTooltip(ISymbol symbol)
        {
            var ambience = AmbienceService.GetCurrentAmbience();
            ambience.ConversionFlags = ConversionFlags.StandardConversionFlags | ConversionFlags.ShowDeclaringType;
            string header = ambience.ConvertSymbol(symbol);

            if (symbol is IParameter) {
                header = "parameter " + header;
            } else if (symbol is IVariable) {
                header = "local variable " + header;
            }

            ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList;
            DocumentationUIBuilder b = new DocumentationUIBuilder(ambience);
            b.AddCodeBlock(header, keepLargeMargin: true);
            return b.CreateFlowDocument();
        }