public void IconDescriptionShoudBeComparableInEqual()
        {
            var id1 = new IconDescription(new PackIconKind(), "test1");
            var id2 = new IconDescription(new PackIconKind(), "test2");

            var result = id1 == id2;

            result.Should().BeFalse();
        }
        public void IconDescriptionShoudBeComparable()
        {
            var id1 = new IconDescription(new PackIconKind(), "test");
            var id2 = new IconDescription(new PackIconKind(), "test");

            var result = id1 == id2;

            result.Should().BeTrue();
        }
Esempio n. 3
0
        internal static DynamicallyVisibleCompletion PythonCompletion(IGlyphService service, string name, string tooltip, StandardGlyphGroup group) {
            var icon = new IconDescription(group, StandardGlyphItem.GlyphItemPublic);

            var result = new DynamicallyVisibleCompletion(name, 
                name, 
                tooltip, 
                service.GetGlyph(group, StandardGlyphItem.GlyphItemPublic),
                Enum.GetName(typeof(StandardGlyphGroup), group));
            result.Properties.AddProperty(typeof(IconDescription), icon);
            return result;
        }
        protected virtual Completion CreateKeywordCompletion(string keyword)
        {
            Contract.Requires<ArgumentNullException>(keyword != null, "keyword");
            Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(keyword));
            Contract.Ensures(Contract.Result<Completion>() != null);

            string displayText = keyword;
            string insertionText = keyword;
            string description = null;
            ImageSource iconSource = Provider.GlyphService.GetGlyph(StandardGlyphGroup.GlyphKeyword, StandardGlyphItem.GlyphItemPublic);
            string iconAutomationText = new IconDescription(StandardGlyphGroup.GlyphKeyword, StandardGlyphItem.GlyphItemPublic).ToString();
            return new Completion(displayText, insertionText, description, iconSource, iconAutomationText);
        }
        protected virtual Completion CreateSnippetCompletion(VsExpansion expansion, ImageSource defaultExpansionGlyph, IconDescription defaultIconDescription)
        {
            if (string.IsNullOrEmpty(expansion.shortcut))
                return null;

            string displayText = expansion.shortcut;
            string insertionText = expansion.shortcut;
            string description = expansion.description;
            return new Completion(displayText, insertionText, description, defaultExpansionGlyph, defaultIconDescription.ToString());
        }
        protected virtual IEnumerable<Completion> GetSnippetCompletions()
        {
            Contract.Ensures(Contract.Result<IEnumerable<Completion>>() != null);

            if (LanguageGuid == Guid.Empty)
                return EmptyCompletions;

            List<Completion> snippetCompletions = new List<Completion>();
            Guid languageGuid = LanguageGuid;
            VsExpansion[] expansions = Provider.ExpansionManager.EnumerateExpansions(languageGuid, new string[] { "Expansion" }, false);
            ImageSource defaultExpansionGlyph = Provider.GlyphService.GetGlyph(StandardGlyphGroup.GlyphCSharpExpansion, StandardGlyphItem.GlyphItemPublic);
            IconDescription defaultIconDescription = new IconDescription(StandardGlyphGroup.GlyphCSharpExpansion, StandardGlyphItem.GlyphItemPublic);
            foreach (var expansion in expansions)
            {
                Completion completion = CreateSnippetCompletion(expansion, defaultExpansionGlyph, defaultIconDescription);
                if (completion == null)
                    continue;

                snippetCompletions.Add(completion);
            }

            return snippetCompletions;
        }
Esempio n. 7
0
        internal static Completion PythonCompletion(IGlyphService service, string name, string tooltip, StandardGlyphGroup group)
        {
            var icon = new IconDescription(group, StandardGlyphItem.GlyphItemPublic);

            var result = new LazyCompletion(name, () => name, () => tooltip, service.GetGlyph(group, StandardGlyphItem.GlyphItemPublic));
            result.Properties.AddProperty(typeof(IconDescription), icon);
            return result;
        }
Esempio n. 8
0
        internal static Completion PythonCompletion(IGlyphService service, MemberResult memberResult)
        {
            StandardGlyphGroup group = memberResult.MemberType.ToGlyphGroup();
            var icon = new IconDescription(group, StandardGlyphItem.GlyphItemPublic);

            var result = new LazyCompletion(memberResult.Name, () => memberResult.Completion, () => memberResult.ToolTip, service.GetGlyph(group, StandardGlyphItem.GlyphItemPublic));
            result.Properties.AddProperty(typeof(IconDescription), icon);
            return result;
        }