public EntityItem(INamespaceSymbol entity) { this.IsInSamePart = true; this.entityNamespace = entity; text = entity.Name; image = CompletionControls.GetImageData(entity).Source; }
public EntityItem(MemberDeclarationSyntax entity) { this.IsInSamePart = true; this.entity = entity; if (entity is TypeDeclarationSyntax) { text = ((TypeDeclarationSyntax)entity).Identifier.ToString(); } else if (entity is ConstructorDeclarationSyntax) { text = ((ConstructorDeclarationSyntax)entity).Identifier.ToString(); } else if (entity is MethodDeclarationSyntax) { text = ((MethodDeclarationSyntax)entity).Identifier.ToString(); } else if (entity is PropertyDeclarationSyntax) { text = ((PropertyDeclarationSyntax)entity).Identifier.ToString(); } else if (entity is FieldDeclarationSyntax) { FieldDeclarationSyntax f = ((FieldDeclarationSyntax)entity); if (f.Declaration.Variables != null) { if (f.Declaration.Variables.Count > 0) { text = f.Declaration.Variables[0].Identifier.ToString(); } } } else if (entity is NamespaceDeclarationSyntax) { text = ((NamespaceDeclarationSyntax)entity).Name.ToString(); } image = CompletionControls.GetImageData(entity).Source; }
public void FilterByKind(object obs, bool add = true) { ICSharpCode.AvalonEdit.CodeCompletion.CompletionListBox c = completionList.ListBox; var b = completionList.Master; List <CsCompletionData> d = new List <CsCompletionData>(); if (add) { if (allitems == false) { foreach (var bc in c.Items) { d.Add(bc as CsCompletionData); } } for (int i = 0; i < completionList.Master.Count; i++) { CsCompletionData dd = (CsCompletionData)completionList.Master[i]; if (CompletionControls.GetHashCode(dd.obs) == (int)obs) { d.Add(dd); } //if (obs is SymbolKind) //{ // SymbolKind s = (SymbolKind)obs; // if (dd.obs is SymbolKind) // if (s == (SymbolKind)dd.obs) // d.Add(dd); //} //else if (obs is TypeKind) //{ // TypeKind s = (TypeKind)obs; // if (dd.obs is TypeKind) // if (s == (TypeKind)dd.obs) // d.Add(dd); //} else if (obs is CsCompletionData) //{ // string s = ((CsCompletionData)obs).obs as string; // if (dd.obs is string) // if ( s == (string)dd.obs) // d.Add(dd); //} } } else { foreach (var bc in c.Items) { d.Add(bc as CsCompletionData); } for (int i = 0; i < c.Items.Count; i++) { CsCompletionData dd = (CsCompletionData)c.Items[i]; if (CompletionControls.GetHashCode(dd.obs) == (int)obs) { d.Remove(dd); } //if (obs is SymbolKind) //{ // SymbolKind s = (SymbolKind)obs; // if (dd.obs is SymbolKind) // if (s == (SymbolKind)dd.obs) // d.Remove(dd); //} //else if (obs is TypeKind) //{ // TypeKind s = (TypeKind)obs; // if (dd.obs is TypeKind) // if (s == (TypeKind)dd.obs) // d.Remove(dd); //} //if (obs is CsCompletionData) //{ // string s = ((CsCompletionData)obs).obs as string; // if (dd.obs is string) // if (s == (string)dd.obs) // d.Remove(dd); //} } } c.ItemsSource = d; }