public Declaration(VsExpansion expansion) { this.Glyph = CompletionGlyph.GetSnippetId(); this.DisplayText = expansion.shortcut; this.Name = expansion.title; this.Description = expansion.description; }
/// <summary> /// Finds the completions. /// </summary> /// <param name="result">The result.</param> /// <param name="line">The line.</param> /// <param name="col">The col.</param> /// <returns></returns> public IList <LanguageServices.Declaration> FindCompletions(object result, int line, int col) { if (result != null) { System.Diagnostics.Trace.WriteLine(result.ToString()); } // Add prolog functions List <LanguageServices.Declaration> members = new List <LanguageServices.Declaration>(); members.AddRange(_prologFunctions.RetrieveCompletions()); // Add Snippets //AddSnippets(ref members); // Add types foreach (Type t in types) { if (t.IsClass || t.IsInterface) { Declaration decl = new Declaration(); decl.Description = t.FullName; decl.DisplayText = t.Name; if (t.IsInterface) { decl.Glyph = CompletionGlyph.GetIndexFor(Accessibility.Public, Element.Interface); } if (t.IsClass) { decl.Glyph = CompletionGlyph.GetIndexFor(Accessibility.Public, Element.Class); } decl.Name = t.FullName; members.Add(decl); } } // Add keywords foreach (string keyword in _keywords) { Declaration decl = new Declaration(); decl.Description = String.Format(CultureInfo.CurrentCulture, "Keyword: {0}", keyword); decl.DisplayText = keyword; decl.Glyph = CompletionGlyph.GetKeywordId(); decl.Name = keyword; members.Add(decl); } members.Sort(); return(members); }
/// <summary> /// Finds the members. /// </summary> /// <param name="result">The result.</param> /// <param name="line">The line.</param> /// <param name="col">The col.</param> /// <returns></returns> public IList <LanguageServices.Declaration> FindMembers(object result, int line, int col) { if (result != null) { System.Diagnostics.Trace.WriteLine(result.ToString()); } else { result = ""; } List <LanguageServices.Declaration> members = new List <LanguageServices.Declaration>(); string sel = ((string)result); if (sel.Length == 0) { List <string> added = new List <string>(); // Only display root elements foreach (Type s in types) { string root = s.FullName.Split('.')[0]; if (!added.Contains(root)) { added.Add(root); Declaration decl = new Declaration(); decl.Description = String.Format("{0} namespace", root); decl.DisplayText = root; decl.Glyph = CompletionGlyph.GetIndexFor(Accessibility.Public, Element.Namespace); decl.Name = root; members.Add(decl); } } } return(members); }