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;
        }
Exemple #2
0
        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);
        }
        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;
        }
        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;
        }
        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);
        }
        protected IList <HtmlCompletion> AddAttributeValues(HtmlCompletionContext context, IEnumerable <string> items)
        {
            List <HtmlCompletion> list = new List <HtmlCompletion>();

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

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

            return(list);
        }
        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;
        }
Exemple #8
0
        public override IList <HtmlCompletion> GetEntries(HtmlCompletionContext context)
        {
            string        text  = context.Document.TextBuffer.CurrentSnapshot.GetText();
            List <string> names = DirectivesCache.GetValues(DirectiveType.Attribute);
            var           list  = new List <HtmlCompletion>();

            foreach (Match match in DirectivesCache.AttributeRegex.Matches(text))
            {
                string name = match.Groups["name"].Value;
                if (!names.Contains(name))
                {
                    names.Add(name);
                }
            }

            foreach (string name in names)
            {
                HtmlCompletion item = CreateItem(name, "Custom directive", context.Session);
                list.Add(item);
            }

            return(list);
        }
        protected IList <HtmlCompletion> AddEntries(HtmlCompletionContext context, IEnumerable <IHtmlItem> items)
        {
            List <HtmlCompletion> 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);
                }

                HtmlCompletion 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 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));
        }