public void AddPackage(string packageName) { CompletionDataList.Add(new PackageCompletionData { Path = packageName, Name = ModuleNameHelper.ExtractModuleName(packageName) }); }
internal ModulePackage GetOrCreateSubPackage(string package, bool create = false) { if (string.IsNullOrEmpty(package)) { return(this); } var currentPackage = this; var parts = ModuleNameHelper.SplitModuleName(package); foreach (string part in parts) { ModulePackage returnValue; var hash = part.GetHashCode(); if (!currentPackage.packages.TryGetValue(hash, out returnValue)) { if (create) { returnValue = currentPackage.packages[hash] = new ModulePackage(currentPackage, part); } else { return(null); } } currentPackage = returnValue; } return(currentPackage); }
internal bool RemoveModule(string name) { name = ModuleNameHelper.ExtractModuleName(name); DModule ast; return(modules.TryRemove(name.GetHashCode(), out ast)); }
public DModule GetModule(string name) { var pack = GetSubPackage(ModuleNameHelper.ExtractPackageName(name)); DModule ast; if (pack == null) { return(null); } pack.modules.TryGetValue(ModuleNameHelper.ExtractModuleName(name).GetHashCode(), out ast); return(ast); }
internal bool AddModule(DModule ast) { if (ast == null || string.IsNullOrEmpty(ast.ModuleName)) { return(false); } var pack = Root.GetOrCreateSubPackage(ModuleNameHelper.ExtractPackageName(ast.ModuleName), true); var modName = ModuleNameHelper.ExtractModuleName(ast.ModuleName); Strings.Add(modName); pack.modules[modName.GetHashCode()] = ast; return(true); }
public DModule GetSubModule(string moduleName) { if (string.IsNullOrEmpty(moduleName)) { return(null); } var pack = GetOrCreateSubPackage(ModuleNameHelper.ExtractPackageName(moduleName)); if (pack == null) { return(null); } return(pack.GetModule(ModuleNameHelper.ExtractModuleName(moduleName))); }
internal bool RemoveModule(string name) { name = ModuleNameHelper.ExtractModuleName(name); DModule ast; if (modules.TryRemove(name.GetHashCode(), out ast)) { var root = Root; if (root != null) { root.UfcsCache.RemoveModuleMethods(ast); } return(true); } return(false); }
static bool CanShowMember(DNode dn, IBlockNode scope) { if (dn.ContainsAttribute(DTokens.Deprecated) && CompletionOptions.Instance.HideDeprecatedNodes) { return(false); } // http://dlang.org/attribute.html#ProtectionAttribute if (dn.ContainsAttribute(DTokens.Private)) { return(dn.NodeRoot == scope.NodeRoot); } else if (dn.ContainsAttribute(DTokens.Package)) { return(dn.NodeRoot is DModule && ModuleNameHelper.ExtractPackageName((dn.NodeRoot as DModule).ModuleName) == ModuleNameHelper.ExtractPackageName((scope.NodeRoot as DModule).ModuleName)); } return(CheckForProtectedAttribute(dn, scope)); }
public ModulePackage GetOrCreateSubPackage(string package, bool create = false) { if (string.IsNullOrEmpty(package)) { return(this); } var currentPackage = this; foreach (var p in ModuleNameHelper.SplitModuleName(package)) { ModulePackage returnValue = null; if (!currentPackage.Packages.TryGetValue(p, out returnValue)) { if (create) { returnValue = currentPackage.Packages[p] = new ModulePackage { Name = p, Parent = currentPackage } } ; else { return(null); } } currentPackage = returnValue; } return(currentPackage); }
internal bool RemovePackage(string name) { return(RemovePackage(ModuleNameHelper.ExtractModuleName(name).GetHashCode())); }
public NamespaceCompletionData(DModule mod) { this.Module = mod; DisplayFlags = ICSharpCode.NRefactory.Completion.DisplayFlags.DescriptionHasMarkup | DisplayFlags.IsImportCompletion; modName = ModuleNameHelper.ExtractModuleName(mod.ModuleName); }