示例#1
0
        public EventCreationCompletionData(CSharpCompletionTextEditorExtension ext, string varName, IType delegateType, IEvent evt, string parameterList, IUnresolvedMember callingMember, IUnresolvedTypeDefinition declaringType) : base(null)
        {
            if (string.IsNullOrEmpty(varName))
            {
                this.DisplayText = "Handle" + (evt != null ? evt.Name : "");
            }
            else
            {
                this.DisplayText = "Handle" + Char.ToUpper(varName[0]) + varName.Substring(1) + (evt != null ? evt.Name : "");
            }

            if (declaringType != null && declaringType.Members.Any(m => m.Name == this.DisplayText))
            {
                for (int i = 1; i < 10000; i++)
                {
                    if (!declaringType.Members.Any(m => m.Name == this.DisplayText + i))
                    {
                        this.DisplayText = this.DisplayText + i.ToString();
                        break;
                    }
                }
            }
            this.editor        = ext.TextEditorData;
            this.parameterList = parameterList;
            this.callingMember = callingMember;
            this.Icon          = "md-newmethod";
            this.initialOffset = editor.Caret.Offset;
        }
示例#2
0
        public MethodParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext, IEnumerable <IMethod> m) : base(ext, startOffset)
        {
            compilation = ext.UnresolvedFileCompilation;
            file        = ext.CSharpUnresolvedFile;

            HashSet <string> alreadyAdded = new HashSet <string> ();

            foreach (var method in m)
            {
                if (method.IsConstructor)
                {
                    continue;
                }
                if (!method.IsBrowsable())
                {
                    continue;
                }
                string str = ambience.GetString(method, OutputFlags.IncludeParameters | OutputFlags.GeneralizeGenerics | OutputFlags.IncludeGenerics);
                if (alreadyAdded.Contains(str))
                {
                    continue;
                }
                alreadyAdded.Add(str);
                methods.Add(method);
            }

            methods.Sort(MethodComparer);
        }
 public TypeCompletionData(IType type, CSharpCompletionTextEditorExtension ext, Lazy <string> displayText, string icon) : base(null, displayText, icon)
 {
     this.type        = type;
     this.ext         = ext;
     this.file        = ext.CSharpUnresolvedFile;
     this.compilation = ext.UnresolvedFileCompilation;
 }
 public DelegateDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext, IType delegateType) : base(ext, startOffset)
 {
     compilation = ext.UnresolvedFileCompilation;
     file        = ext.CSharpUnresolvedFile;
     //			this.delegateType = delegateType;
     this.delegateMethod = delegateType.GetDelegateInvokeMethod();
 }
        public ConstructorParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext, IType type, AstNode skipInitializer = null) : base(startOffset, ext)
        {
            this.type = type;

            var ctx = ext.CSharpUnresolvedFile.GetTypeResolveContext(ext.UnresolvedFileCompilation, ext.Document.Editor.Caret.Location) as CSharpTypeResolveContext;

            var  lookup             = new MemberLookup(ctx.CurrentTypeDefinition, ext.Compilation.MainAssembly);
            bool isProtectedAllowed = false;
            var  typeDefinition     = type.GetDefinition();

            if (ctx.CurrentTypeDefinition != null && typeDefinition != null)
            {
                isProtectedAllowed = ctx.CurrentTypeDefinition.IsDerivedFrom(ctx.CurrentTypeDefinition.Compilation.Import(typeDefinition));
            }
            foreach (var method in type.GetConstructors())
            {
                if (!lookup.IsAccessible(method, isProtectedAllowed))
                {
                    continue;
                }
                if (!method.IsBrowsable())
                {
                    continue;
                }
                if (skipInitializer != null && skipInitializer.Parent.StartLocation == method.Region.Begin)
                {
                    continue;
                }
                methods.Add(method);
            }
            methods.Sort(MethodComparer);
        }
示例#6
0
 public IndexerParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext, IType type, IEnumerable <IProperty> indexers, AstNode resolvedExpression) : base(ext, startOffset)
 {
     compilation = ext.UnresolvedFileCompilation;
     file        = ext.CSharpUnresolvedFile;
     //			this.resolvedExpression = resolvedExpression;
     this.indexers = new List <IProperty> (indexers);
 }
示例#7
0
 public AbstractParameterDataProvider(CSharpCompletionTextEditorExtension ext, int startOffset) : base(startOffset)
 {
     if (ext == null)
     {
         throw new ArgumentNullException("ext");
     }
     this.ext = ext;
 }
示例#8
0
        public NewOverrideCompletionData(CSharpCompletionTextEditorExtension ext, int declarationBegin, IUnresolvedTypeDefinition type, IMember member) : base(null)
        {
            this.ext    = ext;
            this.type   = type;
            this.member = member;

            this.declarationBegin = declarationBegin;
            this.GenerateBody     = true;
            this.Icon             = member.GetStockIcon();
            this.DisplayText      = ambience.GetString(member, OutputFlags.IncludeParameters | OutputFlags.IncludeParameterName | OutputFlags.IncludeGenerics | OutputFlags.HideExtensionsParameter | OutputFlags.IncludeAccessor);
            this.CompletionText   = member.EntityType == EntityType.Indexer ? "this" : member.Name;
        }
示例#9
0
        public MemberCompletionData(CSharpCompletionTextEditorExtension editorCompletion, IEntity entity, OutputFlags flags)
        {
            compilation = editorCompletion.UnresolvedFileCompilation;
            file        = editorCompletion.CSharpUnresolvedFile;

            this.editorCompletion = editorCompletion;
            this.flags            = flags;
            SetMember(entity);
            DisplayFlags = DisplayFlags.DescriptionHasMarkup;
            var m = Entity as IMember;

            if (m != null && m.IsObsolete())
            {
                DisplayFlags |= DisplayFlags.Obsolete;
            }
        }
 public TypeParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext, IEnumerable <IMethod> methods)
 {
     this.startOffset = startOffset;
     //			this.ext = ext;
     this.methods = new List <IMethod> (methods);
 }
示例#11
0
        public TemplateParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext, IEnumerable <IType> types)
        {
            this.startOffset = startOffset;
//			this.ext = ext;
            this.types = new List <IType> (types);
        }
            public CompletionDataFactory(CSharpCompletionTextEditorExtension ext, CSharpResolver state)
            {
//				this.state = state;
                builder  = new TypeSystemAstBuilder(state);
                this.ext = ext;
            }
示例#13
0
 public MethodParameterDataProvider(CSharpCompletionTextEditorExtension ext, IMethod method) : base(ext, 0)
 {
     methods.Add(method);
 }
示例#14
0
 protected MethodParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext) : base(ext, startOffset)
 {
     compilation = ext.UnresolvedFileCompilation;
     file        = ext.CSharpUnresolvedFile;
 }
示例#15
0
 public static TooltipInformation CreateTooltipInformation(CSharpCompletionTextEditorExtension ext, ICompilation compilation, CSharpUnresolvedFile file, IParameterizedMember entity, int currentParameter, bool smartWrap)
 {
     return(CreateTooltipInformation(compilation, file, ext.TextEditorData, ext.FormattingPolicy, entity, currentParameter, smartWrap));
 }
示例#16
0
 public ArrayTypeParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext, ArrayType arrayType, AstNode resolvedNode) : base(ext, startOffset)
 {
     this.arrayType = arrayType;
 }
示例#17
0
 public static TooltipInformation CreateTooltipInformation(CSharpCompletionTextEditorExtension editorCompletion, CSharpResolver resolver, IEntity entity, bool smartWrap)
 {
     return(CreateTooltipInformation(editorCompletion.UnresolvedFileCompilation, editorCompletion.CSharpUnresolvedFile, resolver, editorCompletion.TextEditorData, editorCompletion.FormattingPolicy, entity, smartWrap));
 }
示例#18
0
 public VariableCompletionData(CSharpCompletionTextEditorExtension ext, IVariable variable) : base(variable.Name, variable.GetStockIcon())
 {
     this.ext      = ext;
     this.Variable = variable;
 }