Exemple #1
0
        public override SourcePoint PaintBlock(DelimiterCapableBlock block, DecorateLanguageElementEventArgs args, SourcePoint startPointToPaint, bool multipleBlocksOnLine)
        {
            SourcePoint result = startPointToPaint;

            if (Settings.Enabled && MeetsLengthRquirement(block))
            {
                StringBuilder customMetaBuilder = new StringBuilder();
                customMetaBuilder.Append(String.Format("{0} '{1}'", Settings.BlockTypeName, (block as Class).Name));
                GenericBlock.AppendGenericTypes(block as AccessSpecifiedElement, customMetaBuilder);
                GenericBlock.AppendGenericTemplate(block as AccessSpecifiedElement, customMetaBuilder);

                args.AddForegroundAdornment(
                    new BlockMetaDataDocumentAdornment(startPointToPaint, Settings, customMetaBuilder.ToString()));

                result = startPointToPaint.OffsetPoint(0, customMetaBuilder.Length);
            }
            return(result);
        }
        private string GetMethodMetaString(Method method)
        {
            StringBuilder methodMetaBuilder = new StringBuilder();

            methodMetaBuilder.Append(method.Name);

            GenericBlock.AppendGenericTypes(method, methodMetaBuilder);

            methodMetaBuilder.Append(Words.OpenParen);

            for (int i = 0; i < method.Parameters.Count; i++)
            {
                Param parameter = method.Parameters[i] as Param;

                if (parameter.IsOutParam)
                {
                    methodMetaBuilder.Append(Words.OutParam);
                }

                if (parameter.IsReferenceParam)
                {
                    methodMetaBuilder.Append(Words.RefParam);
                }

                string simpleTypeName = CodeRush.Language.GetSimpleTypeName(parameter.GetTypeName());
                methodMetaBuilder.Append(simpleTypeName);


                if (i < method.Parameters.Count - 1)
                {
                    methodMetaBuilder.Append(Words.CommaDelimiter);
                }
            }
            methodMetaBuilder.Append(Words.CloseParen);

            GenericBlock.AppendGenericTemplate(method, methodMetaBuilder);

            return(methodMetaBuilder.ToString());
        }