本文整理汇总了C#中CompletionDataList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# CompletionDataList.Add方法的具体用法?C# CompletionDataList.Add怎么用?C# CompletionDataList.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompletionDataList
的用法示例。
在下文中一共展示了CompletionDataList.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetElementCompletions
protected override Task<CompletionDataList> GetElementCompletions (CancellationToken token)
{
var list = new CompletionDataList ();
AddMiscBeginTags (list);
var path = GetCurrentPath ();
if (path.Count == 0) {
list.Add (new XmlCompletionData ("Project", XmlCompletionData.DataType.XmlElement));
return Task.FromResult (list);
}
var rr = ResolveElement (path);
if (rr == null)
return Task.FromResult (list);
foreach (var c in rr.BuiltinChildren)
list.Add (new XmlCompletionData (c, XmlCompletionData.DataType.XmlElement));
var inferredChildren = GetInferredChildren (rr);
if (inferredChildren != null)
foreach (var c in inferredChildren)
list.Add (new XmlCompletionData (c, XmlCompletionData.DataType.XmlElement));
return Task.FromResult (list);
}
示例2: GetAttributeCompletions
public override void GetAttributeCompletions (CompletionDataList list, IAttributedXObject attributedOb, Dictionary<string, string> existingAtts)
{
var required = new NodeCompletionCategory ("Required", 0);
var optional = new NodeCompletionCategory ("Optional", 1);
foreach (NodeTypeAttribute att in info.Attributes) {
if (!existingAtts.ContainsKey (att.Name)) {
var data = new NodeTypeAttributeCompletionData (att) {
CompletionCategory = att.Required ? required : optional
};
list.Add (data);
}
}
var ordering = new NodeCompletionCategory ("Ordering", 2);
if (!existingAtts.ContainsKey ("id")) {
list.Add (new CompletionData ("id", null, "ID for the extension, unique in this extension point.") { CompletionCategory = ordering });
}
if (!existingAtts.ContainsKey ("insertbefore")) {
list.Add (new CompletionData ("insertbefore", null, "ID of an existing extension before which to insert this.") { CompletionCategory = ordering });
}
if (!existingAtts.ContainsKey ("insertafter")) {
list.Add (new CompletionData ("insertafter", null, "ID of an existing extension after which to insert this.") { CompletionCategory = ordering });
}
}
示例3: GetElementCompletions
protected override void GetElementCompletions (CompletionDataList list)
{
AddMiscBeginTags (list);
var path = GetCurrentPath ();
if (path.Count == 0) {
list.Add (new XmlCompletionData ("Project", XmlCompletionData.DataType.XmlElement));
} else {
var el = GetMSBuildElement (path);
if (el != null && el.Children != null)
foreach (var c in el.Children)
list.Add (new XmlCompletionData (c, XmlCompletionData.DataType.XmlElement));
}
}
示例4: ShowCodeTemplatesCommand
public virtual ICompletionDataList ShowCodeTemplatesCommand()
{
CompletionDataList list = new CompletionDataList();
list.CompletionSelectionMode = CompletionSelectionMode.OwnTextField;
foreach (CodeTemplate template in CodeTemplateService.Templates) //GetCodeTemplates("text/moscrif"))
list.Add(new CodeTemplateCompletionData(template,this.editor));
return list;
}
示例5: GetElementCompletions
public virtual void GetElementCompletions (CompletionDataList list, XElement element)
{
if (children == null) {
return;
}
foreach (var c in children) {
list.Add (c.Key, null, c.Value.Description);
}
}
示例6: GetAttributeValueCompletions
public override void GetAttributeValueCompletions (CompletionDataList list, IAttributedXObject attributedOb, XAttribute att)
{
if (att.Name.FullName != "path") {
return;
}
foreach (var addin in GetReferencedAddins ()) {
foreach (ExtensionPoint ep in addin.Description.ExtensionPoints) {
list.Add (ep.Path, null, ep.Name + "\n" + ep.Description);
}
}
}
示例7: AddRazorDirectives
public static void AddRazorDirectives (CompletionDataList list)
{
string icon = "md-keyword";
list.Add ("inherits", icon, "Defines a base class of the view");
list.Add ("layout", icon, "Defines a layout file to use in this view");
list.Add ("model", icon, "References a strongly-typed model");
list.Add ("sessionstate", icon, "Defines a sessionstate mode");
list.Add ("helper", icon, "Defines a helper");
list.Add ("section", icon, "Defines a section");
list.Add ("functions", icon, "Enables to define functions in this view");
}
示例8: GetElementCompletions
protected override void GetElementCompletions (CompletionDataList list)
{
AddMiscBeginTags (list);
var path = GetCurrentPath ();
if (path.Count == 0) {
list.Add (new XmlCompletionData ("Project", XmlCompletionData.DataType.XmlElement));
return;
}
var rr = ResolveElement (path);
if (rr == null)
return;
foreach (var c in rr.BuiltinChildren)
list.Add (new XmlCompletionData (c, XmlCompletionData.DataType.XmlElement));
var inferredChildren = GetInferredChildren (rr);
if (inferredChildren != null)
foreach (var c in inferredChildren)
list.Add (new XmlCompletionData (c, XmlCompletionData.DataType.XmlElement));
}
示例9: GetAttributeCompletions
public override void GetAttributeCompletions (CompletionDataList list, IAttributedXObject attributedOb, Dictionary<string, string> existingAtts)
{
if (!existingAtts.ContainsKey ("type")) {
list.Add ("Gettext", null, "Localizes the add-in with a Gettext catalog.");
list.Add ("StringResource", null, "Localizes the add-in with .NET string resources.");
list.Add ("StringTable", null, "Localizes the add-in with string table defined in the manifest.");
return;
}
string type;
if (!existingAtts.TryGetValue ("type", out type)) {
return;
}
if (type == "Gettext") {
if (!existingAtts.ContainsKey ("catalog")) {
list.Add ("catalog", null, "Name of the catalog which contains the strings.");
}
if (!existingAtts.ContainsKey ("location")) {
list.Add ("location", null, "Relative path to the location of the catalog. This path must be relative to the add-in location..");
}
}
}
示例10: AddRazorDirectives
public static void AddRazorDirectives (CompletionDataList list, RazorHostKind kind)
{
string icon = "md-keyword";
list.Add ("helper", icon, GettextCatalog.GetString ("Defines a helper"));
list.Add ("functions", icon, GettextCatalog.GetString ("Defines a region of class members"));
list.Add ("using", icon, GettextCatalog.GetString ("Imports a namespace"));
if (kind == RazorHostKind.WebCode)
return;
list.Add ("inherits", icon, GettextCatalog.GetString ("Defines a base class of the view"));
list.Add ("model", icon, GettextCatalog.GetString ("References a strongly-typed model"));
if (kind == RazorHostKind.WebPage) {
list.Add ("layout", icon, GettextCatalog.GetString ("Defines a layout file to use in this view"));
list.Add ("sessionstate", icon, GettextCatalog.GetString ("Defines a sessionstate mode"));
list.Add ("section", icon, GettextCatalog.GetString ("Defines a section"));
} else if (kind == RazorHostKind.Template) {
list.Add ("__class", icon, GettextCatalog.GetString ("Customizes the generated class"));
list.Add ("__property", icon, GettextCatalog.GetString ("Adds a property"));
}
}
示例11: GetAttributeCompletions
protected override CompletionDataList GetAttributeCompletions (IAttributedXObject attributedOb,
Dictionary<string, string> existingAtts)
{
var el = GetMSBuildElement (GetCurrentPath ());
if (el != null && el.Attributes != null) {
var list = new CompletionDataList ();
foreach (var a in el.Attributes)
if (!existingAtts.ContainsKey (a))
list.Add (new XmlCompletionData (a, XmlCompletionData.DataType.XmlElement));
return list;
}
return null;
}
示例12: AddRazorTemplates
private static void AddRazorTemplates (CompletionDataList list)
{
string icon = "md-template";
list.Add ("inherits", icon, "Template for inherits directive");
list.Add ("model", icon, "Template for model directive");
list.Add ("helper", icon, "Template for helper directive");
list.Add ("section", icon, "Template for section directive");
list.Add ("functions", icon, "Template for functions directive");
list.Add ("using", icon, "Template for using statement");
}
示例13: AddRazorTemplates
static void AddRazorTemplates (CompletionDataList list, RazorHostKind kind)
{
string icon = "md-template";
list.Add ("inherits", icon, GettextCatalog.GetString ("Template for inherits directive"));
list.Add ("model", icon, GettextCatalog.GetString ("Template for model directive"));
list.Add ("helper", icon, GettextCatalog.GetString ("Template for helper directive"));
list.Add ("functions", icon, GettextCatalog.GetString ("Template for functions directive"));
list.Add ("using", icon, GettextCatalog.GetString ("Template for using statement"));
if (kind == RazorHostKind.WebPage) {
list.Add ("section", icon, GettextCatalog.GetString ("Template for section directive"));
}
}
示例14: GetElementCompletions
protected override void GetElementCompletions(CompletionDataList list)
{
var currentPath = GetCurrentPath();
var path = GetPath(currentPath);
var namespaces = GetNamespaces(currentPath);
var completions = Completion.GetCompletions(namespaces).ToList();
var filter = completions.Select(r => r.GetFilter(path)).FirstOrDefault(r => r != null);
foreach (var completion in completions)
{
foreach (var item in completion.GetClasses(path, filter))
{
var xmlCompletion = new XmlCompletionData(item.Name, item.Description, XmlCompletionData.DataType.XmlElement);
xmlCompletion.Icon = Stock.Class;
list.Add(xmlCompletion);
}
}
BaseXmlEditorExtension.AddMiscBeginTags(list);
base.GetElementCompletions(list);
}
示例15: GetCompletionData
/// <summary>
/// Vrati autokompletion pre include,
/// </summary>
/// <returns>
/// Zoznam autoCompletion slov pre include
/// </returns>
public static ICompletionDataList GetCompletionData(this TextEditor editor ,string baseWord,string fullWord)
{
/*
lib - ms a adresare z framevorku
app - ms adresare z projektu
*/
List<string> libsDefine = new List<string>();
GetAllFiles(ref libsDefine,MainClass.Settings.LibDirectory);
//GetAllFiles(ref libsDefine,MainClass.Workspace.ActualProject.AbsolutProjectDir);
CompletionDataList listComplete = new CompletionDataList();
foreach (string str in libsDefine){
CompletionData cd = new CompletionData(str,null,"","\""+str+"\"");
listComplete.Add(cd);
}
//listComplete.AddRange(MainClass.CompletedCache.IncludeCompletion);
return listComplete;
}