Ejemplo n.º 1
0
        public void Apply(CodeCompletionContext context, IList<ILookupItem> result)
        {
            IParameterDescriptorProvider provider = GetParameterDescriptorProvider(context);

            ICollection<IParameterDescriptor> descriptors = provider.GetParameterDescriptors();

            // it's parameters conception hak, TODO fix conception
            IXmlTag tag = context.GetAttributeTag();
            Assert.CheckNotNull(tag);

            foreach (IParameterDescriptor descriptor in descriptors)
            {
                if (!descriptor.IsAttribute)
                    continue;

                // scipr declared attribjutes
                // it's parameters conception hak, TODO fix conception
                if(tag.GetAttribute(descriptor.Name) != null)
                    continue;

                LookupItemBase item = CreateItem(descriptor, context);
                item.InsertRange = new TextRange(0);
                item.ReplaceRange = new TextRange(0, context.GetPrefix().Length);
                result.Add(item);
            }
        }
Ejemplo n.º 2
0
        public void Apply(CodeCompletionContext context, IList<ILookupItem> result)
        {
            IParameterDescriptorProvider parameterDescriptorProvider = GetParameterDescriptorProvider(context);

            ICollection<IParameterDescriptor> descriptors = parameterDescriptorProvider.GetParameterDescriptors();
            foreach (IParameterDescriptor descriptor in descriptors)
            {
                if (descriptor.IsAttribute)
                    continue;

                LookupItemBase item = CreateItem(descriptor, context);
                item.InsertRange = new TextRange(0);
                item.ReplaceRange = new TextRange(0, context.GetPrefix().Length);
                result.Add(item);
            }
        }
Ejemplo n.º 3
0
        public void Apply(CodeCompletionContext context, IList<ILookupItem> result)
        {
            IAppenderRef appenderRef = GetAppenderRef(context);
            Assert.CheckNotNull(appenderRef);

            IL4NSection l4nSection = appenderRef.GetContainingElement<IL4NSection>(false);
            Assert.CheckNotNull(l4nSection);

            ICollection<IAppender> appenders = l4nSection.GetAppenders();

            foreach (IAppender appender in appenders)
            {
                DeclaredElementLookupItem item =
                    new DeclaredElementLookupItem(new DeclaredElementInstance((IDeclaredElement)appender), new DeclaredElementLookupItemCreationContext(context.ProjectFile), L4NLanguageService.L4N);
                item.InsertRange = new TextRange(0);
                item.ReplaceRange = new TextRange(0, context.GetPrefix().Length);
                result.Add(item);
            }
        }
        public void Apply(CodeCompletionContext context, IList<ILookupItem> result)
        {
            IDeclaredParameter declaredParameter = GetDeclaredParameter(context);
            Assert.CheckNotNull(declaredParameter);

            IParameterDescriptor descriptor =
                declaredParameter.ParameterDescriptorProvider.GetParameterDescriptor(declaredParameter.Name);

            LookupItemBase item = null;
            if (!descriptor.RequredType)
                item = new TextLookupItem("value");
            else
                item = new TextLookupItem("type");

            item.InsertRange = new TextRange(0);
            item.ReplaceRange = new TextRange(0, context.GetPrefix().Length);

            result.Add(item);
        }
        public void Apply(CodeCompletionContext context, IList<ILookupItem> result)
        {
            IXmlTag tag = context.GetAttributeTag();
            Assert.CheckNotNull(tag);
            IXmlAttribute attribute = context.Token.GetContainingElement<IXmlAttribute>(false);
            Assert.CheckNotNull(attribute);

            IParameterDescriptor descriptor = null;
            IDeclaredParameter declaredParameter = tag as IDeclaredParameter;
            if (declaredParameter != null && attribute.AttributeName == L4NConstants.VALUE)
            {
                descriptor = declaredParameter.ParameterDescriptorProvider.GetParameterDescriptor(declaredParameter.Name);
            }
            else
            {
                IParameterDescriptorProvider parameterDescriptorProvider = tag as IParameterDescriptorProvider;
                if (parameterDescriptorProvider == null)
                    return;
                descriptor = parameterDescriptorProvider.GetParameterDescriptor(attribute.AttributeName);
            }

            if(descriptor == null)
                return;

            if(!descriptor.IsEnumerable)
                return;

            string[] values = descriptor.PossibleValues;
            if(values == null)
                return;

            foreach (string v in values)
            {
                TextLookupItem item = new TextLookupItem(v);
                item.InsertRange = new TextRange(0);
                item.ReplaceRange = new TextRange(0, context.GetPrefix().Length);
                result.Add(item);
            }
        }