public CompletionInfo(string displayText, StandardGlyphGroup glyph, string insertionText = null, string documentation = null) { DisplayText = displayText; Glyph = glyph; InsertionText = insertionText ?? displayText; Documentation = documentation ?? ""; }
public static ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item) { lock (_lock) { var glyphService = EditorShell.Current.ExportProvider.GetExport <IGlyphService>().Value; return(glyphService.GetGlyph(group, item)); } }
public AphidDeclaration(string name, string description, string displayText, StandardGlyphGroup glyph) { Name = name; Description = description; DisplayText = displayText; Glyph = glyph; }
public SymbolList(string searchText, List <LocationInfo> locations, StandardGlyphGroup glyphType) { foreach (var location in locations) { Children.Add(new SimpleLocationInfo(searchText, location, glyphType)); } }
public SimpleLocationInfo(string searchText, LocationInfo locInfo, StandardGlyphGroup glyphType) { _locationInfo = locInfo; _glyphType = glyphType; _pathText = GetSearchDisplayText(); _lineText = _locationInfo.ProjectEntry.GetLine(_locationInfo.Line); }
private void TestGlyph( StandardGlyphGroup expectedGlyphGroup, SymbolKind kind = SymbolKind.Method, Accessibility declaredAccessibility = Accessibility.NotApplicable, bool isExtensionMethod = true, MethodKind methodKind = MethodKind.Ordinary, INamedTypeSymbol containingType = null, bool isConst = false, ITypeSymbol elementType = null, INamespaceOrTypeSymbol target = null, ITypeSymbol pointedAtType = null, bool isWithEvents = false, TypeKind typeKind = TypeKind.Unknown ) { var symbol = CreateSymbolMock( kind, declaredAccessibility, isExtensionMethod, methodKind, containingType, isConst, elementType, target, pointedAtType, isWithEvents, typeKind ); Assert.Equal(expectedGlyphGroup, symbol.GetGlyph().GetStandardGlyphGroup()); }
public static ImageSource GetGlyph(StandardGlyphGroup @group, StandardGlyphItem item, ICompositionCatalog compositionCatalog) { lock (_lock) { var glyphService = compositionCatalog.ExportProvider.GetExportedValue <IGlyphService>(); return(glyphService.GetGlyph(group, item)); } }
internal SymbolList(string description, StandardGlyphGroup glyphGroup, IEnumerable<SimpleLocationInfo> locations) { _name = description; _glyphGroup = glyphGroup; foreach (var location in locations) { Children.Add(location); } }
public LabelInfo(string name, string description, SnapshotSpan definition, StandardGlyphGroup glyph, IEnumerable <LabelInfo> members) { Name = name; Description = description; Definition = definition; Glyph = glyph; Members = new List <LabelInfo>(members); }
public int GetImageIndex(StandardGlyphGroup standardGlyphGroup, StandardGlyphItem standardGlyphItem) { if (standardGlyphGroup >= StandardGlyphGroup.GlyphGroupError) { return((int)standardGlyphGroup); } return((int)standardGlyphGroup + (int)standardGlyphItem); }
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.Documentation, service.GetGlyph(group, StandardGlyphItem.GlyphItemPublic)); result.Properties.AddProperty(typeof(IconDescription), icon); return(result); }
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; }
public override Completion CreateCompletion(AlloyIntellisenseController controller, ICompletionSession session) { string displayText = Name; string insertionText = Name; string description = string.Empty; StandardGlyphGroup glyphGroup = IsEnum ? StandardGlyphGroup.GlyphGroupEnum : StandardGlyphGroup.GlyphGroupStruct; ImageSource iconSource = controller.Provider.GlyphService.GetGlyph(glyphGroup, StandardGlyphItem.GlyphItemPublic); string iconAutomationText = string.Empty; return(new Completion(displayText, insertionText, description, iconSource, iconAutomationText)); }
public ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item) { if (group >= StandardGlyphGroup.GlyphGroupUnknown) { return(null); } int index = (group < StandardGlyphGroup.GlyphGroupError) ? ((int)group + ((int)item)) : ((int)group); return(this.TryGetImage(index)); }
public SimpleLocationInfo(VsProjectAnalyzer analyzer, IServiceProvider serviceProvider, string searchText, AnalysisLocation locInfo, StandardGlyphGroup glyphType) { _serviceProvider = serviceProvider; _locationInfo = locInfo; _glyphType = glyphType; _pathText = GetSearchDisplayText(); AnalysisEntry entry = analyzer.GetAnalysisEntryFromPath(_locationInfo.FilePath); if (entry != null) { _lineText = entry.GetLine(_locationInfo.Line); } else { _lineText = ""; } }
protected ObjectListItem( ProjectId projectId, StandardGlyphGroup glyphGroup, StandardGlyphItem glyphItem = StandardGlyphItem.GlyphItemPublic, bool isHidden = false) { _projectId = projectId; _glyphIndex = glyphGroup < StandardGlyphGroup.GlyphGroupError ? (ushort)((int)glyphGroup + (int)glyphItem) : (ushort)glyphGroup; _isHidden = isHidden; }
public SimpleLocationInfo(System.IServiceProvider serviceProvider, string searchText, LocationInfo locInfo, StandardGlyphGroup glyphType, GeneroLanguageVersion languageVersion) { _serviceProvider = serviceProvider; _locationInfo = locInfo; _glyphType = glyphType; _languageVersion = languageVersion; _pathText = GetSearchDisplayText(); if (_locationInfo.ProjectEntry != null) { _lineText = _locationInfo.ProjectEntry.GetLine(_locationInfo.Line); } else { _lineText = ""; } }
public static void Initialize(IGlyphService glyphService, IIconService iconService) { var supportedGlyphGroups = new Dictionary <StandardGlyphGroup, string> { { StandardGlyphGroup.GlyphGroupError, "Error" }, { StandardGlyphGroup.GlyphGroupDelegate, "Delegate" }, { StandardGlyphGroup.GlyphGroupEnum, "Enum" }, { StandardGlyphGroup.GlyphGroupStruct, "Struct" }, { StandardGlyphGroup.GlyphGroupClass, "Class" }, { StandardGlyphGroup.GlyphGroupInterface, "Interface" }, { StandardGlyphGroup.GlyphGroupModule, "Module" }, { StandardGlyphGroup.GlyphGroupConstant, "Constant" }, { StandardGlyphGroup.GlyphGroupEnumMember, "EnumMember" }, { StandardGlyphGroup.GlyphGroupEvent, "Event" }, { StandardGlyphGroup.GlyphExtensionMethodPrivate, "ExtensionMethodPrivate" }, { StandardGlyphGroup.GlyphExtensionMethodProtected, "ExtensionMethodProtected" }, { StandardGlyphGroup.GlyphExtensionMethodInternal, "ExtensionMethodInternal" }, { StandardGlyphGroup.GlyphExtensionMethod, "ExtensionMethod" }, { StandardGlyphGroup.GlyphGroupMethod, "Method" }, { StandardGlyphGroup.GlyphGroupProperty, "Property" }, { StandardGlyphGroup.GlyphGroupField, "Field" }, { StandardGlyphGroup.GlyphGroupOperator, "Operator" }, { StandardGlyphGroup.GlyphReference, "Reference" } }; var supportedGlyphItems = new Dictionary <StandardGlyphItem, string> { { StandardGlyphItem.GlyphItemPrivate, "Private" }, { StandardGlyphItem.GlyphItemProtected, "Protected" }, { StandardGlyphItem.GlyphItemInternal, "Internal" }, { StandardGlyphItem.GlyphItemPublic, "Public" }, { StandardGlyphItem.GlyphItemFriend, "Friend" } }; foreach (var groupKvp in supportedGlyphGroups) { foreach (var itemKvp in supportedGlyphItems) { string iconName = GetIconName(groupKvp.Value, itemKvp.Value); StandardGlyphGroup localGroup = groupKvp.Key; StandardGlyphItem localItem = itemKvp.Key; iconService.AddIcon(iconName, iconName, () => glyphService.GetGlyph(localGroup, localItem)); } } }
private void SaveGlyphsToDisk(string folder) { Array groups = Enum.GetValues(typeof(StandardGlyphGroup)); Array items = Enum.GetValues(typeof(StandardGlyphItem)); foreach (var groupName in groups) { int count = 0; string glyphFolder = Path.Combine(folder, groupName.ToString()); var sprite = new WriteableBitmap(16, 16 * (items.Length), 96, 96, PixelFormats.Pbgra32, null); sprite.Lock(); foreach (var itemName in items) { StandardGlyphGroup group = (StandardGlyphGroup)groupName; StandardGlyphItem item = (StandardGlyphItem)itemName; BitmapSource glyph = _glyphService.GetGlyph(group, item) as BitmapSource; if (glyph == null) { continue; } string fileName = Path.Combine(folder, group.ToString(), item.ToString() + ".png"); SaveBitmapToDisk(glyph, fileName); int stride = glyph.PixelWidth * (glyph.Format.BitsPerPixel / 8); byte[] data = new byte[stride * glyph.PixelHeight]; glyph.CopyPixels(data, stride, 0); sprite.WritePixels( new Int32Rect(0, count, glyph.PixelWidth, glyph.PixelHeight), data, stride, 0); count += 16; } sprite.Unlock(); SaveBitmapToDisk(sprite, Path.Combine(folder, "_sprites", groupName + ".png")); } }
private static Icon GetIcon(IGlyphService glyphService, StandardGlyphGroup glyphGroup) { Icon icon = null; if (_iconCache.TryGetValue(glyphGroup, out icon)) { return(icon); } BitmapSource glyph = glyphService.GetGlyph(glyphGroup, StandardGlyphItem.GlyphItemPublic) as BitmapSource; if (glyph != null) { Bitmap bmp = new Bitmap(glyph.PixelWidth, glyph.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); glyph.CopyPixels(Int32Rect.Empty, bmpData.Scan0, bmpData.Height * bmpData.Stride, bmpData.Stride); bmp.UnlockBits(bmpData); icon = Icon.FromHandle(bmp.GetHicon()); } _iconCache[glyphGroup] = icon; return(icon); }
public ImageSource CreateGlyph(uint key) { StandardGlyphGroup group = (StandardGlyphGroup)(key >> 16); StandardGlyphItem item = (StandardGlyphItem)(key & 0xFFFF); ImageSource source = null; // create the glyph on the UI thread Dispatcher dispatcher = Dispatcher; if (dispatcher == null) { source = null; } else { dispatcher.Invoke((Action)( () => { source = GlyphService.GetGlyph(group, item); })); } return(source); }
internal static IEnumerable <CompletionInfo> ToCompletionInfo(IEnumerable <string> keys, StandardGlyphGroup glyph) { return(keys.Select(key => new CompletionInfo(key, glyph, key))); }
private void SetupVerifiableGlyph(StandardGlyphGroup standardGlyphGroup, StandardGlyphItem standardGlyphItem) { _glyphServiceMock.Setup(service => service.GetGlyph(standardGlyphGroup, standardGlyphItem)) .Returns(CreateIconBitmapSource()) .Verifiable(); }
public int GetImageIndex(StandardGlyphGroup standardGlyphGroup, StandardGlyphItem standardGlyphItem) { if (standardGlyphGroup >= StandardGlyphGroup.GlyphGroupError) return (int)standardGlyphGroup; return (int)standardGlyphGroup + (int)standardGlyphItem; }
public ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item) { return(new DrawingImage()); }
public static StandardGlyphGroup getGlyphGroup(this IXSymbol elt) { StandardGlyphGroup imgG = StandardGlyphGroup.GlyphGroupClass; switch (elt.Kind) { case Kind.Class: imgG = StandardGlyphGroup.GlyphGroupClass; break; case Kind.Constructor: case Kind.Destructor: case Kind.Method: case Kind.Function: case Kind.Procedure: case Kind.LocalFunc: case Kind.LocalProc: case Kind.VODLL: imgG = StandardGlyphGroup.GlyphGroupMethod; break; case Kind.Structure: imgG = StandardGlyphGroup.GlyphGroupStruct; break; case Kind.Access: case Kind.Assign: case Kind.Property: imgG = StandardGlyphGroup.GlyphGroupProperty; break; case Kind.Local: case Kind.MemVar: case Kind.DbField: case Kind.Parameter: imgG = StandardGlyphGroup.GlyphGroupVariable; break; case Kind.Event: imgG = StandardGlyphGroup.GlyphGroupEvent; break; case Kind.Delegate: imgG = StandardGlyphGroup.GlyphGroupDelegate; break; case Kind.Enum: imgG = StandardGlyphGroup.GlyphGroupEnum; break; case Kind.EnumMember: imgG = StandardGlyphGroup.GlyphGroupEnumMember; break; case Kind.Operator: imgG = StandardGlyphGroup.GlyphGroupOperator; break; case Kind.Interface: imgG = StandardGlyphGroup.GlyphGroupInterface; break; case Kind.Namespace: imgG = StandardGlyphGroup.GlyphGroupNamespace; break; case Kind.Field: case Kind.VOGlobal: imgG = StandardGlyphGroup.GlyphGroupField; break; case Kind.Union: imgG = StandardGlyphGroup.GlyphGroupUnion; break; case Kind.VODefine: case Kind.Define: case Kind.Undefine: imgG = StandardGlyphGroup.GlyphGroupConstant; break; case Kind.VOStruct: imgG = StandardGlyphGroup.GlyphGroupValueType; break; case Kind.Keyword: imgG = StandardGlyphGroup.GlyphKeyword; break; case Kind.Using: imgG = StandardGlyphGroup.GlyphReference; break; case Kind.Attribute: imgG = StandardGlyphGroup.GlyphGroupIntrinsic; break; case Kind.Command: case Kind.XCommand: case Kind.Translate: case Kind.XTranslate: imgG = StandardGlyphGroup.GlyphGroupMacro; break; case Kind.TypeParameter: imgG = StandardGlyphGroup.GlyphGroupType; break; case Kind.Unknown: case Kind.Ignore: case Kind.Undeclared: imgG = StandardGlyphGroup.GlyphGroupUnknown; break; } return(imgG); }
public SimpleCompletionEntry(string text, StandardGlyphGroup glyph, IIntellisenseSession session) : this(text, null, glyph, session) { }
public ImageSource getImage(StandardGlyphGroup group, StandardGlyphItem item, IGlyphService glyphService) { return(glyphService.GetGlyph(group, item)); }
private System.Windows.Media.ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item) { return(this.sourceProvider.GlyphService.GetGlyph(group, item)); }
public AphidDeclaration(string name, StandardGlyphGroup glyph) : this(name, null, name, glyph) { }
public ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item) { return new DrawingImage(); }
public SimpleCompletionEntry(string text, string description, StandardGlyphGroup glyph, IIntellisenseSession session) : base(text, "\"" + text + "\"", description, GlyphService.GetGlyph(glyph, StandardGlyphItem.GlyphItemPublic), null, false, session as ICompletionSession) { }
public static ImageSource GetGlyphThreadSafe(this IGlyphService glyphService, StandardGlyphGroup @group, StandardGlyphItem item) { lock (_lock) { return glyphService.GetGlyph(group, item); } }
internal static IEnumerable <CompletionInfo> ToCompletionInfo(Dictionary <string, TagInfo> dictionary, StandardGlyphGroup glyph) { if (dictionary == null) { return(Enumerable.Empty <CompletionInfo>()); } return(dictionary.Select(key => new CompletionInfo(key.Key, glyph, key.Key, key.Value.Documentation))); }
private void TestGlyph( StandardGlyphGroup expectedGlyphGroup, SymbolKind kind = SymbolKind.Method, Accessibility declaredAccessibility = Accessibility.NotApplicable, bool isExtensionMethod = true, MethodKind methodKind = MethodKind.Ordinary, INamedTypeSymbol containingType = null, bool isConst = false, ITypeSymbol elementType = null, INamespaceOrTypeSymbol target = null, ITypeSymbol pointedAtType = null, bool isWithEvents = false, TypeKind typeKind = TypeKind.Unknown) { var symbol = CreateSymbolMock(kind, declaredAccessibility, isExtensionMethod, methodKind, containingType, isConst, elementType, target, pointedAtType, isWithEvents, typeKind); Assert.Equal(expectedGlyphGroup, symbol.GetGlyph().GetStandardGlyphGroup()); }
internal static IEnumerable <CompletionInfo> ToCompletionInfo <T>(Dictionary <string, T> dictionary, StandardGlyphGroup glyph) { if (dictionary == null) { return(Enumerable.Empty <CompletionInfo>()); } return(ToCompletionInfo(dictionary.Keys, glyph)); }
private static Icon GetIcon(IGlyphService glyphService, StandardGlyphGroup glyphGroup) { Icon icon = null; if (_iconCache.TryGetValue(glyphGroup, out icon)) { return icon; } BitmapSource glyph = glyphService.GetGlyph(glyphGroup, StandardGlyphItem.GlyphItemPublic) as BitmapSource; if (glyph != null) { Bitmap bmp = new Bitmap(glyph.PixelWidth, glyph.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); glyph.CopyPixels(Int32Rect.Empty, bmpData.Scan0, bmpData.Height * bmpData.Stride, bmpData.Stride); bmp.UnlockBits(bmpData); icon = Icon.FromHandle(bmp.GetHicon()); } _iconCache[glyphGroup] = icon; return icon; }
public Icon GetIcon(StandardGlyphGroup group, StandardGlyphItem item) { var key = ((uint)group << 16) + (uint)item; return _iconCache.GetOrAdd(key, CreateIcon); }
public CompletionListEntry(string name, int sortingPriority = 0, StandardGlyphGroup glyph = StandardGlyphGroup.GlyphGroupEnumMember) { _name = name; _glyph = glyph; SortingPriority = sortingPriority; }
public ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item) { uint key = ((uint)group << 16) + (uint)item; return _glyphCache.GetOrAdd(key, CreateGlyph); }
public ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item) { return null; }
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; }