CompletionDataList GetPathCompletion(string subPath) { CompletionContext ctx = GetCompletionContext(1); if (!(ctx is ExtensionCompletionContext)) { return(null); } ModuleCompletionContext mc = (ModuleCompletionContext)ctx.GetParentContext(typeof(ModuleCompletionContext)); Set <string> paths = new Set <string> (); CompletionDataList cp = new CompletionDataList(); foreach (AddinDependency adep in mc.Module.Dependencies) { Addin addin = registry.GetAddin(adep.FullAddinId); if (addin != null && addin.Description != null) { foreach (ExtensionPoint ep in addin.Description.ExtensionPoints) { if (ep.Path.StartsWith(subPath)) { string spath = ep.Path.Substring(subPath.Length); int i = spath.IndexOf('/'); if (i != -1) { spath = spath.Substring(0, i); } if (paths.Add(spath)) { if (i == -1) // Full match. Add the documentation { cp.Add(spath, "md-extension-point", ep.Name + "\n" + ep.Description); } else { cp.Add(spath, "md-literal"); } } } } } } return(cp); }
public CompletionContext GetParentContext(Type type) { if (parentContext != null) { if (type.IsInstanceOfType(parentContext)) { return(parentContext); } else { return(parentContext.GetParentContext(type)); } } else { return(null); } }