public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var result = new List<HtmlCompletion>();
            var attr = context.Element.GetAttribute("property");

            if (attr != null && attr.Value.Equals("og:type", StringComparison.OrdinalIgnoreCase))
            {
                result.Add(new SimpleHtmlCompletion("article"));
                result.Add(new SimpleHtmlCompletion("book"));
                result.Add(new SimpleHtmlCompletion("music.album"));
                result.Add(new SimpleHtmlCompletion("music.playlist"));
                result.Add(new SimpleHtmlCompletion("music.radio_station"));
                result.Add(new SimpleHtmlCompletion("music.song"));
                result.Add(new SimpleHtmlCompletion("profile"));
                result.Add(new SimpleHtmlCompletion("video.episode"));
                result.Add(new SimpleHtmlCompletion("video.movie"));
                result.Add(new SimpleHtmlCompletion("video.movie"));
                result.Add(new SimpleHtmlCompletion("video.other"));
                result.Add(new SimpleHtmlCompletion("video.tv_show"));
                result.Add(new SimpleHtmlCompletion("website"));

            }

            return result;
        }
Exemplo n.º 2
0
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            List<HtmlCompletion> list = new List<HtmlCompletion>();

            bool isValid = IsValid(context.Element);
            string name = context.Attribute != null ? context.Attribute.Name : string.Empty;
            int dotIndex = name.IndexOf('.');

            if (isValid && dotIndex == -1 && 
                context.Element.Name != "html" && 
                context.Element.Name != "head" && 
                context.Element.Name != "body")
            {
                var entry = new SimpleHtmlCompletion("repeat.for", context.Session);
                entry.IconSource = _icon;
                list.Add(entry);
            }
            
            if (dotIndex == -1)
                return list;

            if (isValid && !name.StartsWith("repeat."))
            {
                list.Add(new SimpleHtmlCompletion("bind", "", name + "bind", _icon, context.Session));
                list.Add(new SimpleHtmlCompletion("two-way", "Force two-way data binding", name + "two-way", _icon, context.Session));
                list.Add(new SimpleHtmlCompletion("one-way", "Force one-way data binding", name + "one-way", _icon, context.Session));
                list.Add(new SimpleHtmlCompletion("one-time", "Force one-time data binding", name + "one-time", _icon, context.Session));
                list.Add(new SimpleHtmlCompletion("delegate", "Attaches a delegated event", name + "delegate", _icon, context.Session));
                list.Add(new SimpleHtmlCompletion("trigger", "Attaches an event to the element", name + "trigger", _icon, context.Session));
            }

            return list;
        }
 private static IEnumerable<HtmlCompletion> CreateCompletionItems(HtmlCompletionContext context)
 {
     foreach (string item in _classes)
     {
         yield return new SimpleHtmlCompletion(item, context.Session) { IconSource = _icon };
     }
 }
        public override IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var list = new List<HtmlCompletion>();
            string tagName = context.Element.Name.ToLowerInvariant();
            string attrName = context.Attribute.Name.ToLowerInvariant();


            var all = HtmlCache.Elements.Single(e => e.Name == "*").Attributes.ToList();

            HtmlElement element = HtmlCache.Elements.SingleOrDefault(e => e.Name == tagName);

            if (element != null && element.Attributes != null)
                all.AddRange(element.Attributes);

            var attributes = new List<HtmlAttribute>();

            foreach (var attribute in all)
            {
                if (!string.IsNullOrEmpty(attribute.Require))
                {
                    if (context.Element.GetAttribute(attribute.Require) != null)
                        attributes.Add(attribute);
                }
                else
                {
                    attributes.Add(attribute);
                }
            }

            var attr = attributes.SingleOrDefault(a => a.Name == attrName);

            return AddAttributeValues(context, attr?.Values);
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var list = new HashSet<string>();

            context.Document.HtmlEditorTree.RootNode.Accept(this, list);

            return new List<HtmlCompletion>(list.Select(s => new SimpleHtmlCompletion(s, context.Session)));
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            IList<HtmlCompletion> result;
            var attr = context.Element.GetAttribute(KeyProperty);

            values.TryGetValue(attr.Value, out result);
            return result ?? Empty;
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var list = new HashSet<string>();
            var glyph = GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic);

            context.Document.HtmlEditorTree.RootNode.Accept(this, list);

            return list.Select(s => new HtmlCompletion(s, s, s, glyph, HtmlIconAutomationText.AttributeIconText)).ToList();
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            HashSet<bool> isAngular = new HashSet<bool>();
            context.Document.HtmlEditorTree.RootNode.Accept(this, isAngular);

            if (isAngular.Count == 0)
                return new List<HtmlCompletion>();

            return CreateCompletionItems(context).ToArray();
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var list = new HashSet<string>();

            if (context.Element != null && _inputTypes.Contains(context.Element.Name))
            {
                context.Document.HtmlEditorTree.RootNode.Accept(this, list);
            }

            return new List<HtmlCompletion>(list.Select(s => new SimpleHtmlCompletion(s, context.Session)));
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            string fileName = context.Document.TextBuffer.GetFileName();
            var ngHierarchy = this.HierarchyProvider.Get(fileName);
            var completions = new List<HtmlCompletion>();

            AddDirectives(context, ngHierarchy, completions);
            AddDirectiveAttributes(context, ngHierarchy, completions);

            return completions;
        }
 public void FilterCompletionList(IList<HtmlCompletion> completions, HtmlCompletionContext context)
 {
     foreach (var completion in completions)
     {
         if (completion.DisplayText.StartsWith("msapplication-", StringComparison.OrdinalIgnoreCase)||
             completion.DisplayText.StartsWith("x-ms-", StringComparison.OrdinalIgnoreCase))
         {
             completion.IconSource = _icon;
         }
     }
 }
Exemplo n.º 12
0
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var list = new HashSet<string>();

            if (context.Attribute != null && _attrs.Contains(context.Attribute.Name))
            {
                context.Document.HtmlEditorTree.RootNode.Accept(this, list);
            }

            return list.Select(s => new SimpleHtmlCompletion(s, context.Session)).ToList<HtmlCompletion>();
        }
Exemplo n.º 13
0
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var result = new List<HtmlCompletion>();
            var attr = context.Element.GetAttribute("name");

            if (attr != null && attr.Value.Equals("viewport", StringComparison.OrdinalIgnoreCase))
            {
                result.Add(new SimpleHtmlCompletion("width=device-width, initial-scale=1.0", "Example viewport value"));
            }

            return result;
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            List<HtmlCompletion> list = new List<HtmlCompletion>();

            foreach (string attr in GetAttributes())
            {
                var entry = new HtmlCompletion(attr, attr, attr, _icon, null, context.Session as ICompletionSession);
                list.Add(entry);
            }

            return list;
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var result = new List<HtmlCompletion>();
            var attr = context.Element.GetAttribute("name");

            if (attr != null && _booleanNames.Contains(attr.Value.ToLowerInvariant()))
            {
                result.Add(new SimpleHtmlCompletion("false"));
                result.Add(new SimpleHtmlCompletion("true"));
            }

            return result;
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var list = new HashSet<string>();
            string tooltip = string.Empty;

            if (context.Element != null && _inputTypes.Contains(context.Element.Name))
            {
                context.Document.HtmlEditorTree.RootNode.Accept(this, list);
                tooltip = "Extracted from a <label> element in this document";
            }

            return list.Select(s => new HtmlCompletion(s, s, tooltip, _glyph, HtmlIconAutomationText.AttributeIconText, null)).ToList();
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var result = new List<HtmlCompletion>();
            var list = new List<string>();

            context.Document.HtmlEditorTree.RootNode.Accept(this, list);

            foreach (var item in list)
            {
                result.Add(new SimpleHtmlCompletion(item));
            }

            return result;
        }
        public virtual IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            IEnumerable<string> result;
            var attr = context.Element.GetAttribute(KeyProperty);
            if (attr == null)
                return Empty;

            if (values.TryGetValue(attr.Value, out result))
            {
                return result.Select(s => new SimpleHtmlCompletion(s, context.Session)).ToList<HtmlCompletion>();
            }

            return Empty;
        }
Exemplo n.º 19
0
        protected IList<HtmlCompletion> AddAttributeValues(HtmlCompletionContext context, IEnumerable<string> items)
        {
            var list = new List<HtmlCompletion>();

            if (items == null)
                return list;

            foreach (string item in items)
            {
                var entry = new HtmlCompletion(item, item, "", _glyph, null, context.Session as ICompletionSession);
                list.Add(entry);
            }

            return list;
        }
        private static void AddDirectives(HtmlCompletionContext context, NgHierarchy ngHierarchy, List<HtmlCompletion> completions)
        {
            var directives = ngHierarchy.Directives.Value
                .Where(d => d.Restrict.HasFlag(NgDirectiveRestrict.Attribute))
                .Select(
                    d => new HtmlCompletion(
                        d.DashedName,
                        d.DashedName,
                        d.Name,
                        AttributeIcon,
                        "Directive",
                        context.Session));

            completions.AddRange(directives);
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var result = new List<HtmlCompletion>();
            var attr = context.Element.GetAttribute("http-equiv");

            if (attr != null && attr.Value.Equals("X-UA-Compatible", StringComparison.OrdinalIgnoreCase))
            {
                result.Add(new SimpleHtmlCompletion("IE=edge", "Comma separate multiple value if needed"));
                result.Add(new SimpleHtmlCompletion("IE=7", "Comma separate multiple value if needed"));
                result.Add(new SimpleHtmlCompletion("IE=8", "Comma separate multiple value if needed"));
                result.Add(new SimpleHtmlCompletion("IE=9", "Comma separate multiple value if needed"));
                result.Add(new SimpleHtmlCompletion("FF=3", "Comma separate multiple value if needed"));
            }

            return result;
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var result = new List<HtmlCompletion>();
            var list = new List<string>();
            var glyph = GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic);

            context.Document.HtmlEditorTree.RootNode.Accept(this, list);

            foreach (var item in list)
            {
                var completion = new HtmlCompletion(item, item, item, glyph, HtmlIconAutomationText.AttributeIconText);
                result.Add(completion);
            }

            return result;
        }
Exemplo n.º 23
0
        public void FilterCompletionList(IList<HtmlCompletion> completions, HtmlCompletionContext context)
        {
            if (context.Attribute == null || !IsValid(context.Element))
                return;

            string name = context.Attribute.Name;

            if (!name.Contains("."))
                return;

            foreach (var completion in completions)
            {
                if (completion.IconSource != _icon)
                    completion.FilterType = CompletionEntryFilterTypes.NeverVisible;
            }
        }
Exemplo n.º 24
0
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var result = new List<HtmlCompletion>();
            var attr = context.Element.GetAttribute("rel");

            if (attr == null)
                return result;

            if (attr.Value.Equals("apple-touch-icon", StringComparison.OrdinalIgnoreCase))
            {
                result.Add(new SimpleHtmlCompletion("72x72"));
                result.Add(new SimpleHtmlCompletion("114x114"));
                result.Add(new SimpleHtmlCompletion("144x144"));
            }

            return result;
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            string fileName = context.Document.TextBuffer.GetFileName();
            var ngHierarchy = this.HierarchyProvider.Get(fileName);

            return ngHierarchy.Directives.Value
                .Where(d => d.Restrict.HasFlag(NgDirectiveRestrict.Element))
                .Select(
                    d => new HtmlCompletion(
                        d.DashedName,
                        d.DashedName,
                        d.Name,
                        ElementIcon,
                        "Directive",
                        context.Session))
                .ToList();
        }
        private static void AddDirectiveAttributes(HtmlCompletionContext context, NgHierarchy ngHierarchy, List<HtmlCompletion> completions)
        {
            var directive = ngHierarchy.Directives.Value.FirstOrDefault(x => x.Restrict.HasFlag(NgDirectiveRestrict.Element) && x.DashedName == context.Element.Name);
            if (directive != null)
            {
                var attributes = directive.Attributes
                    .Select(
                        a => new HtmlCompletion(
                            a.DashedName,
                            a.DashedName,
                            a.Name,
                            AttributeIcon,
                            "DirectiveAttribute",
                            context.Session));

                completions.AddRange(attributes);
            }
        }
		public override IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
		{
			var attr = context.Element.GetAttribute("property");

			if (attr == null)
				return Empty;

			if (attr.Value.Equals("og:site_name", StringComparison.OrdinalIgnoreCase)
			 || attr.Value.Equals("og:title", StringComparison.OrdinalIgnoreCase))
			{
				if (context.Element.Parent == null)
					return Empty;

				var list = new HashSet<string>();
				context.Element.Parent.Accept(this, list);
				return new List<HtmlCompletion>(list.Select(l => new SimpleHtmlCompletion(l, context.Session)));
			}

			return base.GetEntries(context);
		}
Exemplo n.º 28
0
        protected IList<HtmlCompletion> AddEntries(HtmlCompletionContext context, IEnumerable<IHtmlItem> items)
        {
            var list = new List<HtmlCompletion>();

            if (items == null)
                return list;

            foreach (IHtmlItem item in items)
            {
                string description = item.Description;

                if (!string.IsNullOrEmpty(item.Type))
                    description += Environment.NewLine + Environment.NewLine + "Type: " + CultureInfo.CurrentCulture.TextInfo.ToTitleCase(item.Type);

                var entry = new HtmlCompletion(item.Name, item.Name, description.Trim(), _icon, null, context.Session as ICompletionSession);
                list.Add(entry);
            }

            return list;
        }
        public new IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var attr = context.Element.GetAttribute("name");

            if (attr == null)
                return Empty;

            if (attr.Value.Equals("application-name", StringComparison.OrdinalIgnoreCase)
             || attr.Value.Equals("msapplication-tooltip", StringComparison.OrdinalIgnoreCase))
            {
                if (context.Element.Parent == null)
                    return Empty;

                var list = new HashSet<string>();

                context.Element.Parent.Accept(this, list);
                return Values(list);
            }

            return base.GetEntries(context);
        }
        public IList<HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var result = new List<HtmlCompletion>();
            var attr = context.Element.GetAttribute("name");

            if (attr == null)
                return result;

            if (attr.Value.Equals("twitter:card", StringComparison.OrdinalIgnoreCase))
            {
                result.Add(new SimpleHtmlCompletion("app"));
                result.Add(new SimpleHtmlCompletion("gallery"));
                result.Add(new SimpleHtmlCompletion("photo"));
                result.Add(new SimpleHtmlCompletion("player"));
                result.Add(new SimpleHtmlCompletion("product"));
                result.Add(new SimpleHtmlCompletion("summary"));
                result.Add(new SimpleHtmlCompletion("summary_large-image"));
            }

            return result;
        }
        public override IList <HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var attr = context.Element.GetAttribute("property");

            if (attr == null)
            {
                return(Empty);
            }

            if (attr.Value.Equals("og:site_name", StringComparison.OrdinalIgnoreCase) ||
                attr.Value.Equals("og:title", StringComparison.OrdinalIgnoreCase))
            {
                if (context.Element.Parent == null)
                {
                    return(Empty);
                }

                var list = new HashSet <string>();
                context.Element.Parent.Accept(this, list);
                return(new List <HtmlCompletion>(list.Select(l => new SimpleHtmlCompletion(l, context.Session))));
            }

            return(base.GetEntries(context));
        }
Exemplo n.º 32
0
        public static IList <HtmlCompletion> ChangeIcons(HtmlCompletionContext context)
        {
            Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
            {
                try
                {
                    if (context == null || context.Session == null || context.Session.CompletionSets == null || context.Session.CompletionSets.Count == 0)
                    {
                        return;
                    }

                    foreach (var item in context.Session.CompletionSets[0].Completions)
                    {
                        if (!string.IsNullOrEmpty(item.DisplayText) && (item.DisplayText.StartsWith("ng-", StringComparison.Ordinal) || item.DisplayText.StartsWith("data-ng-", StringComparison.Ordinal)))
                        {
                            item.IconSource = _icon;
                        }
                    }
                }
                catch { /* Ignore. Internal error in VS */ }
            }), DispatcherPriority.Normal, null);

            return(new List <HtmlCompletion>());
        }
        public override IList <HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            List <HtmlCompletion> list = new List <HtmlCompletion>();
            string tagName             = context.Element.Name.ToLowerInvariant();
            string attrName            = context.Attribute.Name.ToLowerInvariant();

            List <HtmlAttribute> all = HtmlElementsContainer.Elements.ExtendedSingle("Looking for * tag", e => e.Name == "*").Attributes.ToList();

            HtmlElement element = HtmlElementsContainer.Elements.ExtendedSingleOrDefault($"Looking for {tagName} tag", e => e.Name == tagName);

            if (element != null && element.Attributes != null)
            {
                all.AddRange(element.Attributes);
            }

            List <HtmlAttribute> attributes = new List <HtmlAttribute>();

            foreach (HtmlAttribute attribute in all)
            {
                if (!string.IsNullOrEmpty(attribute.Require))
                {
                    if (context.Element.GetAttribute(attribute.Require) != null)
                    {
                        attributes.Add(attribute);
                    }
                }
                else
                {
                    attributes.Add(attribute);
                }
            }

            HtmlAttribute attr = attributes.ExtendedSingleOrDefault($"Looking for attribute {attrName}", a => a.Name == attrName);

            return(AddAttributeValues(context, attr?.Values));
        }
Exemplo n.º 34
0
        public IList <HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var attr = context.Element.GetAttribute("ui-sref");

            if (attr == null)
            {
                return(new HtmlCompletion[0]);
            }
            else
            {
                string fileName    = context.Document.TextBuffer.GetFileName();
                var    ngHierarchy = this.HierarchyProvider.Get(fileName);
                return(ngHierarchy.States
                       .Value
                       .Select(x => new HtmlCompletion(
                                   x.Name,
                                   x.Name,
                                   x.Name,
                                   LinkIcon,
                                   "State",
                                   context.Session))
                       .ToArray());
            }
        }
Exemplo n.º 35
0
        protected IList <HtmlCompletion> AddEntries(HtmlCompletionContext context, IEnumerable <IHtmlItem> items)
        {
            var list = new List <HtmlCompletion>();

            if (items == null)
            {
                return(list);
            }

            foreach (IHtmlItem item in items)
            {
                string description = item.Description;

                if (!string.IsNullOrEmpty(item.Type))
                {
                    description += Environment.NewLine + Environment.NewLine + "Type: " + CultureInfo.CurrentCulture.TextInfo.ToTitleCase(item.Type);
                }

                var entry = new HtmlCompletion(item.Name, item.Name, description.Trim(), _icon, null, context.Session as ICompletionSession);
                list.Add(entry);
            }

            return(list);
        }
        public IList <HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            var result = new List <HtmlCompletion>();
            var attr   = context.Element.GetAttribute("property");

            if (attr != null && attr.Value.Equals("og:type", StringComparison.OrdinalIgnoreCase))
            {
                result.Add(new SimpleHtmlCompletion("article"));
                result.Add(new SimpleHtmlCompletion("book"));
                result.Add(new SimpleHtmlCompletion("music.album"));
                result.Add(new SimpleHtmlCompletion("music.playlist"));
                result.Add(new SimpleHtmlCompletion("music.radio_station"));
                result.Add(new SimpleHtmlCompletion("music.song"));
                result.Add(new SimpleHtmlCompletion("profile"));
                result.Add(new SimpleHtmlCompletion("video.episode"));
                result.Add(new SimpleHtmlCompletion("video.movie"));
                result.Add(new SimpleHtmlCompletion("video.movie"));
                result.Add(new SimpleHtmlCompletion("video.other"));
                result.Add(new SimpleHtmlCompletion("video.tv_show"));
                result.Add(new SimpleHtmlCompletion("website"));
            }

            return(result);
        }
        public IList <HtmlCompletion> GetEntries(HtmlCompletionContext ctx)
        {
            var hmiPrj = GetHmiProject(ctx);

            if (hmiPrj == null)
            {
                return(Empty);
            }

            var attrs = ctx.Element.Attributes;

            if (attrs.Get("data-tchmi-type") != null)
            {
                return(null);
            }

            var ctrlProvider = hmiPrj.GetControlProvider();

            if (ctrlProvider?.AvailableControls == null)
            {
                return(Empty);
            }

            var ctrlList = new List <HtmlCompletion>();

            foreach (var it in ctrlProvider.AvailableControls)
            {
                if (it == null)
                {
                    continue;
                }
                if (!it.Visible)
                {
                    continue;
                }

                var typeName    = it.Name;
                var displayText = $"Create {it.DisplayName}";
                var identifier  = typeName.ToCamelCase().GenerateRandomIdentifier();

                var entries = new Dictionary <string, string>();

                if (attrs.Get("id") == null)
                {
                    entries.Add("id", identifier);
                }
                if (attrs.Get("data-tchmi-type") == null)
                {
                    entries.Add("data-tchmi-type", typeName);
                }
                if (attrs.Get("data-tchmi-width") == null)
                {
                    entries.Add("data-tchmi-width", "200");
                }
                if (attrs.Get("data-tchmi-height") == null)
                {
                    entries.Add("data-tchmi-height", "40");
                }

                var insertionText = string.Empty;
                foreach (var itt in entries)
                {
                    insertionText += $"{itt.Key}=\"{itt.Value}\" ";
                }
                insertionText = " " + insertionText.Trim();

                var icon     = GetIconByType(it);
                var listItem = new HtmlCompletion(displayText, insertionText, it.Description.Trim(), icon, null, ctx.Session)
                {
                    SortingPriority = 500
                };

                ctrlList.Add(listItem);
            }

            return(new List <HtmlCompletion>(ctrlList));
        }
Exemplo n.º 38
0
 public IList <HtmlCompletion> GetEntries(HtmlCompletionContext context)
 {
     return(ChangeIcons(context));
 }
Exemplo n.º 39
0
 public abstract IList <HtmlCompletion> GetEntries(HtmlCompletionContext context);
Exemplo n.º 40
0
 public override IList <HtmlCompletion> GetEntries(HtmlCompletionContext context)
 {
     return(AddEntries(context, HtmlElementsContainer.Elements.Where(elem => elem.Type != "existing")));
 }
Exemplo n.º 41
0
 public IList <HtmlCompletion> GetEntries(HtmlCompletionContext context)
 {
     return(AngularLogoCompletion.ChangeIcons(context));
 }