public MarkupBuilder GetLabel(DeltinScript deltinScript, LabelInfo labelInfo) { var builder = new MarkupBuilder().StartCodeLine().Add("new " + Type.GetName()); builder.Add(CodeParameter.GetLabels(deltinScript, labelInfo.AnonymousLabelInfo, Parameters)).EndCodeLine(); if (labelInfo.IncludeDocumentation) { builder.NewSection().Add(Documentation); } return(builder); }
public override void Call(ParseInfo parseInfo, DocRange callRange) { MarkupBuilder hoverContents = new MarkupBuilder() .StartCodeLine() .Add((_constant ? "constant " : "enum ") + Name) .EndCodeLine(); if (_constant) { hoverContents.NewSection().Add("Constant workshop types cannot be stored. Variables with this type cannot be changed from their initial value."); } parseInfo.Script.AddHover(callRange, hoverContents.ToString()); parseInfo.Script.AddToken(callRange, TokenType, TokenModifiers.ToArray()); }
/// <summary>Calls a type from the specified document range.</summary> /// <param name="parseInfo">The script that the type was called from.</param> /// <param name="callRange">The range of the call.</param> public virtual void Call(ParseInfo parseInfo, DocRange callRange) { parseInfo.Script.AddToken(callRange, TokenType, TokenModifiers.ToArray()); var hover = new MarkupBuilder().StartCodeLine().Add(Kind.ToString().ToLower() + " " + Name); if (Generics.Length != 0) { hover.Add("<" + string.Join(", ", Generics.Select(g => g.GetName())) + ">"); } hover.EndCodeLine(); if (Description != null) { hover.NewSection().Add(Description); } parseInfo.Script.AddHover(callRange, hover); }