public MethodParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext, IEnumerable <IMethod> m) : base(ext, startOffset)
        {
            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);
        }
            static bool IsBracketAlreadyInserted(CSharpCompletionTextEditorExtension ext)
            {
                var Editor = ext.Editor;
                int offset = Editor.CaretOffset;

                while (offset < Editor.Length)
                {
                    char ch = Editor.GetCharAt(offset);
                    if (!char.IsLetterOrDigit(ch))
                    {
                        break;
                    }
                    offset++;
                }
                while (offset < Editor.Length)
                {
                    char ch = Editor.GetCharAt(offset);
                    if (!char.IsWhiteSpace(ch))
                    {
                        return(ch == '(');
                    }
                    offset++;
                }
                return(false);
            }
        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);
        }
 public ImportSymbolCompletionData(CSharpCompletionTextEditorExtension ext, RoslynCodeCompletionFactory factory, ISymbol type, bool useFullName) : base(null, factory, type)
 {
     this.ext           = ext;
     this.useFullName   = useFullName;
     this.type          = type;
     this.DisplayFlags |= DisplayFlags.IsImportCompletion;
 }
Example #5
0
        public EventCreationCompletionData(CSharpCompletionTextEditorExtension ext, string methodName, IType delegateType, IEvent evt, string parameterList, IUnresolvedMember callingMember, IUnresolvedTypeDefinition declaringType) : base(null)
        {
            if (string.IsNullOrEmpty(methodName))
            {
                this.DisplayText = (evt != null ? evt.Name : "");
            }
            else
            {
                this.DisplayText = Char.ToUpper(methodName[0]) + methodName.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;
        }
 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);
 }
Example #7
0
 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 ImportSymbolCompletionData(CSharpCompletionTextEditorExtension ext, INamedTypeSymbol type, bool useFullName) : base(null, type.Name)
 {
     this.ext           = ext;
     this.useFullName   = useFullName;
     this.type          = type;
     this.DisplayFlags |= DisplayFlags.IsImportCompletion;
 }
Example #9
0
        public DelegateDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext, IType delegateType)
        {
            this.startOffset = startOffset;
//			this.ext = ext;
            this.delegateType   = delegateType;
            this.delegateMethod = delegateType.GetDelegateInvokeMethod();
        }
Example #10
0
 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 IndexerParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext, IType type, AstNode resolvedExpression)
        {
            this.startOffset = startOffset;
//			this.ext = ext;

            this.resolvedExpression = resolvedExpression;
            indexers = new List <IProperty> (type.GetProperties(p => p.IsIndexer));
        }
 protected AbstractParameterDataProvider(CSharpCompletionTextEditorExtension ext, int startOffset) : base(startOffset)
 {
     if (ext == null)
     {
         throw new ArgumentNullException("ext");
     }
     this.ext = ext;
 }
        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;
        }
 public RoslynCodeCompletionFactory(CSharpCompletionTextEditorExtension ext, SemanticModel semanticModel)
 {
     if (ext == null)
     {
         throw new ArgumentNullException("ext");
     }
     if (semanticModel == null)
     {
         throw new ArgumentNullException("semanticModel");
     }
     this.semanticModel = semanticModel;
     this.ext           = ext;
 }
Example #15
0
        public MemberCompletionData(CSharpCompletionTextEditorExtension editorCompletion, IEntity entity, OutputFlags flags)
        {
            this.editorCompletion = editorCompletion;
            this.flags            = flags;
            SetMember(entity);
            DisplayFlags = DisplayFlags.DescriptionHasMarkup;
            var m = Entity as IMember;

            if (m != null && m.IsObsolete())
            {
                DisplayFlags |= DisplayFlags.Obsolete;
            }
        }
Example #16
0
        internal static bool InsertSemicolon(CSharpCompletionTextEditorExtension ext, int exprStart)
        {
            var Editor = ext.Editor;
            int offset = exprStart;

            while (offset > 0)
            {
                char ch = Editor.GetCharAt(offset);
                if (!char.IsWhiteSpace(ch))
                {
                    if (ch != '{' && ch != '}' && ch != ';')
                    {
                        return(false);
                    }
                    break;
                }
                offset--;
            }

            offset = Editor.CaretOffset;
            while (offset < Editor.Length)
            {
                char ch = Editor.GetCharAt(offset);
                if (!char.IsLetterOrDigit(ch))
                {
                    break;
                }
                offset++;
            }
            while (offset < Editor.Length)
            {
                char ch = Editor.GetCharAt(offset);
                if (!char.IsWhiteSpace(ch))
                {
                    return(char.IsLetter(ch) || ch == '}');
                }
                offset++;
            }
            return(true);
        }
Example #17
0
 public MonoCSharpCompletionEngine(CSharpCompletionTextEditorExtension ext, ICSharpCode.NRefactory.Editor.IDocument document, ICompletionContextProvider completionContextProvider, ICompletionDataFactory factory, ICSharpCode.NRefactory.TypeSystem.IProjectContent content, ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpTypeResolveContext ctx) : base(document, completionContextProvider, factory, content, ctx)
 {
     this.ext = ext;
 }
        public TemplateParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext, IEnumerable <IType> types)
        {
            this.startOffset = startOffset;
//			this.ext = ext;
            this.types = new List <IType> (types);
        }
Example #19
0
 public VariableCompletionData(CSharpCompletionTextEditorExtension ext, IVariable variable) : base(variable.Name, variable.GetStockIcon())
 {
     this.ext      = ext;
     this.Variable = variable;
 }
 public MonoCSharpCompletionEngine(CSharpCompletionTextEditorExtension ext, ICSharpCode.NRefactory.Editor.IDocument document, ICompletionContextProvider completionContextProvider, ICompletionDataFactory factory, ICSharpCode.NRefactory.TypeSystem.IProjectContent content, ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpTypeResolveContext ctx) : base(document, completionContextProvider, factory, content, ctx)
 {
     this.ext = ext;
     this.mdRefactoringCtx = MDRefactoringContext.Create(ext.Document, ext.Document.Editor.Caret.Location);
 }
Example #21
0
            public CompletionDataFactory(CSharpCompletionTextEditorExtension ext, CSharpResolver state)
            {
//				this.state = state;
                builder  = new TypeSystemAstBuilder(state);
                this.ext = ext;
            }
Example #22
0
 public static TooltipInformation CreateTooltipInformation(CSharpCompletionTextEditorExtension ext, ICompilation compilation, CSharpUnresolvedFile file, IParameterizedMember entity, int currentParameter, bool smartWrap)
 {
     return(CreateTooltipInformation(compilation, file, ext.Editor, ext.FormattingPolicy, entity, currentParameter, smartWrap));
 }
Example #23
0
 protected MethodParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext) : base(ext, startOffset)
 {
     compilation = ext.UnresolvedFileCompilation;
     file        = ext.CSharpUnresolvedFile;
 }
 protected MethodParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext) : base(ext, startOffset)
 {
 }
Example #25
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));
 }
Example #26
0
 public TypeParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext, IEnumerable <IMethod> methods)
 {
     this.startOffset = startOffset;
     //			this.ext = ext;
     this.methods = new List <IMethod> (methods);
 }
 public MethodParameterDataProvider(CSharpCompletionTextEditorExtension ext, IMethod method)
 {
     this.ext = ext;
     methods.Add(method);
 }
Example #28
0
 public ArrayTypeParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext, ArrayType arrayType) : base(ext, startOffset)
 {
     this.arrayType = arrayType;
 }
 public MethodParameterDataProvider(CSharpCompletionTextEditorExtension ext, IMethod method) : base(ext, 0)
 {
     methods.Add(method);
 }
 protected MethodParameterDataProvider(int startOffset, CSharpCompletionTextEditorExtension ext)
 {
     this.startOffset = startOffset;
     this.ext         = ext;
 }