public RichText? Format()

in resharper/resharper-unity/src/Unity.Shaders/ShaderLab/Psi/DeclaredElements/ShaderLabDeclaredElementPresenter.cs [15:87]


        public RichText? Format(DeclaredElementPresenterStyle style, IDeclaredElement element, ISubstitution substitution,
            out DeclaredElementPresenterMarking marking)
        {
            marking = new DeclaredElementPresenterMarking();
            if (!(element is IShaderLabDeclaredElement))
                return null;

            var result = new StringBuilder();

            if (style.ShowEntityKind != EntityKindForm.NONE)
            {
                var entityKind = GetEntityKind(element);
                if (entityKind != string.Empty)
                {
                    if (style.ShowEntityKind == EntityKindForm.NORMAL_IN_BRACKETS)
                        entityKind = "(" + entityKind + ")";
                    marking.EntityKindRange = AppendString(result, entityKind);
                    result.Append(" ");
                }
            }

            if (style.ShowNameInQuotes)
                result.Append("\'");

            if (style.ShowType == TypeStyle.DEFAULT)
            {
                var typeName = GetTypeName(element);
                if (!string.IsNullOrEmpty(typeName))
                {
                    marking.TypeRange = marking.ScalarTypeRange = AppendString(result, typeName);
                    result.Append(" ");
                }
            }

            if (style.ShowName != NameStyle.NONE)
            {
                if (element is ShaderLabCommandDeclaredElement command)
                    marking.NameRange = AppendCommandName(result, command.ShortName, command.EntityName);
                else 
                    marking.NameRange = AppendString(result, element.ShortName);
                result.Append(" ");
            }

            if (style.ShowType == TypeStyle.AFTER)
            {
                var typeName = GetTypeName(element);
                if (!string.IsNullOrEmpty(typeName))
                {
                    result.Append(": ");
                    marking.TypeRange = marking.ScalarTypeRange = AppendString(result, typeName);
                    result.Append(" ");
                }
            }

            if (style.ShowNameInQuotes)
            {
                TrimString(result);
                result.Append("\'");
            }

            if (style.ShowName != NameStyle.NONE && style.ShowName != NameStyle.SHORT &&
                style.ShowName != NameStyle.SHORT_RAW)
            {
                AppendDisplayName(result, element);
            }

            if (style.ShowConstantValue)
            {
            }

            TrimString(result);
            return result.ToString();
        }