Example #1
0
        public bool IsPluginNeeded([NotNull] IProject project)
        {
            var assetsDir = GetAssetsDirectory(project);

            if (assetsDir == null)
            {
                return(false); // not a Unity project
            }
            var jetBrainsDir = assetsDir
                               .CombineWithShortName("Plugins")
                               .CombineWithShortName("Editor")
                               .CombineWithShortName("JetBrains");

            if (!jetBrainsDir.ExistsDirectory)
            {
                return(true);
            }

            var existingFiles = new JetHashSet <string>(jetBrainsDir.GetChildFiles().Select(f => f.Name));

            return(ourPluginFiles.Any(f => !existingFiles.Contains(f)));
        }
        private ISymbolTable GetSymbolTable(HtmlCodeCompletionContext context)
        {
            var completeableReference      = context.Reference as ICompletableReference;
            var smartCompleteableReference = completeableReference as IHtmlSmartCompletableReference;

            ISymbolTable symbolTable;

            if (context.BasicContext.CodeCompletionType == CodeCompletionType.SmartCompletion &&
                smartCompleteableReference != null)
            {
                symbolTable = smartCompleteableReference.GetSmartCompletionSymbolTable();
            }
            else if (completeableReference != null)
            {
                symbolTable = completeableReference.GetCompletionSymbolTable();
            }
            else
            {
                return(EmptySymbolTable.INSTANCE);
            }

            if (context.Reference is IHtmlAttributeReference && context.TreeNode != null)
            {
                var header = context.TreeNode.GetContainingNode <IHtmlTagHeader>();
                var node   = context.BasicContext.File.FindNodeAt(context.BasicContext.CaretDocumentOffset);
                if (node != null && header != null)
                {
                    node = node.GetContainingNode <ITagAttribute>(true);
                    var existingNames = new JetHashSet <string>(
                        header.Attributes.Where(attribute => attribute != node).Select(arg => arg.AttributeName), StringComparer.OrdinalIgnoreCase);
                    symbolTable = symbolTable.Filter(new ExistingNamesFilter(existingNames));
                }
            }

            return(symbolTable.Filter(new PredicateFilter(symbol =>
            {
                return Abbreviations.Any(a => symbol.ShortName.StartsWith(a));
            })));
        }
Example #3
0
        protected override bool AddLookupItems(T4CodeCompletionContext context, IItemsCollector collector)
        {
            ITreeNode node = context.BasicContext.File.FindNodeAt(context.BasicContext.SelectedTreeRange);

            Assertion.AssertNotNull(node, "node == null");
            var ranges = context.BasicContext.GetRanges(node);

            collector.AddRanges(ranges);

            var directive = node.GetContainingNode <IT4Directive>();

            Assertion.AssertNotNull(directive, "directive != null");
            DirectiveInfo directiveInfo = _directiveInfoManager.GetDirectiveByName(directive.GetName());

            if (directiveInfo == null)
            {
                return(false);
            }

            JetHashSet <string> existingNames = directive
                                                .GetAttributes()
                                                .Select(attr => attr.GetName())
                                                .ToJetHashSet(s => s, StringComparer.OrdinalIgnoreCase);

            foreach (string attributeName in directiveInfo.SupportedAttributes.Select(attr => attr.Name))
            {
                if (existingNames.Contains(attributeName))
                {
                    continue;
                }

                var item = new TextLookupItem(attributeName);
                item.InitializeRanges(ranges, context.BasicContext);
                collector.Add(item);
            }

            return(true);
        }
        public UnityExternalFilesModuleProcessor(Lifetime lifetime, ILogger logger, ISolution solution,
                                                 ChangeManager changeManager,
                                                 IShellLocks locks,
                                                 ISolutionLoadTasksScheduler scheduler,
                                                 IFileSystemTracker fileSystemTracker,
                                                 ProjectFilePropertiesFactory projectFilePropertiesFactory,
                                                 UnityYamlPsiSourceFileFactory psiSourceFileFactory,
                                                 UnityExternalFilesModuleFactory moduleFactory,
                                                 UnityYamlDisableStrategy unityYamlDisableStrategy,
                                                 ISettingsSchema settingsSchema,
                                                 SettingsLayersProvider settingsLayersProvidert)
        {
            myLifetime                     = lifetime;
            myLogger                       = logger;
            mySolution                     = solution;
            myChangeManager                = changeManager;
            myLocks                        = locks;
            myFileSystemTracker            = fileSystemTracker;
            myProjectFilePropertiesFactory = projectFilePropertiesFactory;
            myPsiSourceFileFactory         = psiSourceFileFactory;
            myModuleFactory                = moduleFactory;
            myUnityYamlDisableStrategy     = unityYamlDisableStrategy;

            changeManager.RegisterChangeProvider(lifetime, this);

            myRootPaths = new JetHashSet <FileSystemPath>();

            // SolutionDirectory isn't absolute in tests, and will throw an exception if we use it when we call Exists
            mySolutionDirectory = solution.SolutionDirectory;
            if (!mySolutionDirectory.IsAbsolute)
            {
                mySolutionDirectory = solution.SolutionDirectory.ToAbsolutePath(FileSystemUtil.GetCurrentDirectory());
            }

            scheduler.EnqueueTask(new SolutionLoadTask(GetType().Name + ".Activate",
                                                       SolutionLoadTaskKinds.PreparePsiModules,
                                                       () => myChangeManager.AddDependency(myLifetime, mySolution.PsiModules(), this)));
        }
Example #5
0
        object IChangeProvider.Execute(IChangeMap changeMap)
        {
            var projectModelChange = changeMap.GetChange <ProjectModelChange>(mySolution);

            if (projectModelChange == null)
            {
                return(null);
            }

            // ReSharper hasn't necessarily processed all references when it adds the IProject
            // to the IViewableProjectsCollection. Keep an eye on reference changes, add the
            // project settings if/when the project becomes a unity project
            var projects = new JetHashSet <IProject>();

            var changes = ReferencedAssembliesService.TryGetAssemblyReferenceChanges(projectModelChange, ProjectExtensions.UnityReferenceNames);

            foreach (var change in changes)
            {
                if (change.IsAdded)
                {
                    var project = change.GetNewProject();
                    if (project.IsUnityProject())
                    {
                        projects.Add(project);
                    }
                }
            }

            foreach (var project in projects)
            {
                myChangeManager.ExecuteAfterChange(() =>
                {
                    Handle(project);
                });
            }

            return(null);
        }
        public UnityPluginInstaller(
            Lifetime lifetime,
            ILogger logger,
            ISolution solution,
            IShellLocks shellLocks,
            UnityPluginDetector detector,
            RdNotificationsModel notifications,
            ISettingsStore settingsStore,
            PluginPathsProvider pluginPathsProvider)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myLifetime            = lifetime;
            myLogger              = logger;
            mySolution            = solution;
            myShellLocks          = shellLocks;
            myDetector            = detector;
            myNotifications       = notifications;
            myPluginPathsProvider = pluginPathsProvider;

            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));
            myQueue = new ProcessingQueue(myShellLocks, myLifetime);
        }
Example #7
0
        // Return a context object for the item being searched for, or null if the element isn't interesting.
        // CanContainReferences isn't called if we return null. Do the work once here, then use it multiple times for
        // each file in CanContainReferences
        public object GetElementId(IDeclaredElement element)
        {
            if (!UnityYamlUsageSearchFactory.IsInterestingElement(element))
            {
                return(null);
            }

            var set = new JetHashSet <IPsiSourceFile>();

            switch (element)
            {
            case IClass _class:
                foreach (var sourceFile in myAssetUsagesElementContainer.GetPossibleFilesWithUsage(_class))
                {
                    set.Add(sourceFile);
                }
                break;

            case IProperty _:
            case IMethod _:
                foreach (var sourceFile in myAssetMethodsElementContainer.GetPossibleFilesWithUsage(element))
                {
                    set.Add(sourceFile);
                }
                break;

            case IField field:
                foreach (var sourceFile in myInspectorValuesContainer.GetPossibleFilesWithUsage(field))
                {
                    set.Add(sourceFile);
                }
                break;
            }

            return(new UnityYamlSearchGuruId(set));
        }
Example #8
0
        private List <string> InitElementsMap(IEnumerable <IUnitTestElement> unitTestElements,
                                              Dictionary <string, IUnitTestElement> elementToIdMap)
        {
            var result = new JetHashSet <string>();

            foreach (var unitTestElement in unitTestElements)
            {
                if (unitTestElement is NUnitTestElement)
                {
                    var unityName = string.Format(unitTestElement.Id);
                    elementToIdMap[unityName] = unitTestElement;
                    result.Add(unityName);
                }

                if (unitTestElement is UnityTestElement)
                {
                    var unityName = string.Format(unitTestElement.Id);
                    elementToIdMap[unityName] = unitTestElement;
                    result.Add(unityName);
                }
            }

            return(result.ToList());
        }
Example #9
0
        object IChangeProvider.Execute(IChangeMap changeMap)
        {
            var projectModelChange = changeMap.GetChange <ProjectModelChange>(mySolution);

            if (projectModelChange == null)
            {
                return(null);
            }

            var changes = ReferencedAssembliesService.TryGetAssemblyReferenceChanges(projectModelChange,
                                                                                     ProjectExtensions.UnityReferenceNames, myLogger);

            var newUnityProjects = new JetHashSet <IProject>();

            foreach (var change in changes)
            {
                if (change.IsAdded)
                {
                    var project = change.GetNewProject();
                    if (project.IsUnityProject())
                    {
                        newUnityProjects.Add(project);
                    }
                }
            }

            myChangeManager.ExecuteAfterChange(() =>
            {
                foreach (var project in newUnityProjects)
                {
                    OnUnityProjectAdded(project);
                }
            });

            return(null);
        }
Example #10
0
        public UnityPluginInstaller(
            Lifetime lifetime,
            ILogger logger,
            ISolution solution,
            IShellLocks shellLocks,
            UnityPluginDetector detector,
            RdNotificationsModel notifications,
            ISettingsStore settingsStore,
            ProjectReferenceChangeTracker changeTracker)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myLifetime           = lifetime;
            myLogger             = logger;
            mySolution           = solution;
            myShellLocks         = shellLocks;
            myDetector           = detector;
            myNotifications      = notifications;
            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));

            BindToInstallationSettingChange();

            changeTracker.RegisterProjectChangeHandler(InstallPluginIfRequired);
        }
            public CgSyntaxHighlightingProcess(IDaemonProcess daemonProcess, IContextBoundSettingsStore settingsStore, ICgFile file, bool isErrorHighlightingEnabled, JetHashSet <string> semantics)
#if RIDER
                : base(daemonProcess, file)
            #else
                : base(daemonProcess, settingsStore, file)
Example #12
0
        protected override bool AddLookupItems(CSharpCodeCompletionContext context, GroupedItemsCollector collector)
        {
            var settingsStore = context.BasicContext.File.GetSettingsStore();

            if (!settingsStore.GetValue(PostfixSettingsAccessor.ShowPostfixItems))
            {
                return(false);
            }

            var executionContext = new ReparsedPostfixExecutionContext(myLifetime, context.BasicContext, context.UnterminatedContext, "__");
            var postfixContext   = myTemplatesManager.IsAvailable(context.UnterminatedContext.TreeNode, executionContext);

            if (postfixContext == null) // try unterminated context if terminated sucks
            {
                executionContext = new ReparsedPostfixExecutionContext(myLifetime, context.BasicContext, context.TerminatedContext, "__;");
                postfixContext   = myTemplatesManager.IsAvailable(context.TerminatedContext.TreeNode, executionContext);
            }

            if (postfixContext == null)
            {
                return(false);
            }

            // nothing to check :(
            if (postfixContext.Expressions.Count == 0 && postfixContext.TypeExpression == null)
            {
                return(false);
            }

            var lookupItems = myTemplatesManager.CollectItems(postfixContext);

            if (lookupItems.Count == 0)
            {
                return(false);
            }

            ICollection <string> toRemove = EmptyList <string> .InstanceList;

            // double completion support
            var parameters         = context.BasicContext.Parameters;
            var isDoubleCompletion = (parameters.CodeCompletionTypes.Length > 1);

            if (!executionContext.IsAutoCompletion && isDoubleCompletion)
            {
                var firstCompletion = parameters.CodeCompletionTypes[0];
                if (firstCompletion != CodeCompletionType.AutomaticCompletion)
                {
                    return(false);
                }

                // run postfix templates like we are in auto completion
                executionContext.IsAutoCompletion = true;

                var automaticPostfixItems = myTemplatesManager.CollectItems(postfixContext);
                if (automaticPostfixItems.Count > 0)
                {
                    toRemove = new JetHashSet <string>(StringComparer.Ordinal);
                    foreach (var lookupItem in automaticPostfixItems)
                    {
                        toRemove.Add(lookupItem.Identity);
                    }
                }
            }

            foreach (var lookupItem in lookupItems)
            {
                if (toRemove.Contains(lookupItem.Identity))
                {
                    continue;
                }

                if (isDoubleCompletion)
                {
                    collector.AddToTop(lookupItem);
                }
                else
                {
                    collector.AddSomewhere(lookupItem);
                }
            }

            return(lookupItems.Count > 0);
        }
        public Dictionary <int, Dictionary <string, IAssetValue> > GetImportedValuesForUnityEvent(LocalReference scriptLocation, JetHashSet <string> allUnityEventNames)
        {
            var result = new Dictionary <int, Dictionary <string, IAssetValue> >();

            foreach (var modification in myPrefabInstanceHierarchy.PrefabModifications)
            {
                if (!(modification.Target is ExternalReference externalReference))
                {
                    continue;
                }

                if (!modification.PropertyPath.Contains("m_PersistentCalls"))
                {
                    continue;
                }

                var location = new LocalReference(Location.OwningPsiPersistentIndex, PrefabsUtil.GetImportedDocumentAnchor(myPrefabInstanceHierarchy.Location.LocalDocumentAnchor, externalReference.LocalDocumentAnchor));
                if (!location.Equals(scriptLocation))
                {
                    continue;
                }

                var parts          = modification.PropertyPath.Split('.');
                var unityEventName = parts[0];
                if (!allUnityEventNames.Contains(unityEventName))
                {
                    continue;
                }

                var dataPart = parts.FirstOrDefault(t => t.StartsWith("data"));
                if (dataPart == null)
                {
                    continue;
                }

                if (!int.TryParse(dataPart.RemoveStart("data[").RemoveEnd("]"), out var index))
                {
                    continue;
                }

                var last = parts.Last();

                if (!result.TryGetValue(index, out var modifications))
                {
                    modifications = new Dictionary <string, IAssetValue>();
                    result[index] = modifications;
                }

                switch (last)
                {
                case "m_Mode" when modification.Value is AssetSimpleValue simpleValue:
                    modifications[last] = simpleValue;
                    break;

                case "m_MethodName" when modification.Value is AssetSimpleValue simpleValue:
                    modifications[last] = simpleValue;
                    modifications["m_MethodNameRange"] = new Int2Value(modification.ValueRange.StartOffset, modification.ValueRange.EndOffset);
                    break;

                case "m_Target" when modification.ObjectReference is IHierarchyReference objectReference:
                    modifications[last] = new AssetReferenceValue(objectReference);
                    break;
                }
            }

            return(result);
        }
 public NitraTextOccurenceSearcher(IEnumerable <string> texts)
 {
     myTexts = new JetHashSet <string>(texts.Where(value => !string.IsNullOrEmpty(value)));
 }
Example #15
0
 public CgSyntaxHighlightingProcess(IDaemonProcess daemonProcess, ICgFile file, bool isErrorHighlightingEnabled, JetHashSet <string> semantics)
     : base(daemonProcess, file)
 {
     myIsErrorHighlightingEnabled = isErrorHighlightingEnabled;
     mySemantics = semantics;
 }
Example #16
0
 public UnityYamlSearchGuruId(JetHashSet <IPsiSourceFile> files)
 {
     Files = files;
 }
        private ISearchDomain NarrowSearchDomain(ISolution solution, IEnumerable<string> words, IEnumerable<string> extendedWords, ISearchDomain domain)
        {
            List<string> allWords = words.ToList();
            List<string> allExtendedWords = extendedWords.ToList();

            if (domain.IsEmpty || allWords.IsEmpty())
                return domain;
            IWordIndex wordIndex = solution.GetPsiServices().CacheManager.WordIndex;
            var jetHashSet1 = new JetHashSet<IPsiSourceFile>(wordIndex.GetFilesContainingWord(allWords.First()), null);
            foreach (string word in allWords.Skip(1))
                jetHashSet1.IntersectWith(wordIndex.GetFilesContainingWord(word));
            if (allExtendedWords.Any())
            {
                var jetHashSet2 = new JetHashSet<IPsiSourceFile>(null);
                using (JetHashSet<IPsiSourceFile>.ElementEnumerator enumerator = jetHashSet1.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        IPsiSourceFile file = enumerator.Current;
                        if (allExtendedWords.Any(word => wordIndex.CanContainWord(file, word)))
                            jetHashSet2.Add(file);
                    }
                }
                jetHashSet1 = jetHashSet2;
            }
            return domain.Intersect(searchDomainFactory.CreateSearchDomain(jetHashSet1));
        }
Example #18
0
        public IEnumerable <string> GetAllPossibleWordsInFile(IDeclaredElement element)
        {
            var names = new JetHashSet <string>();

            var constructor = element as IConstructor;

            if (constructor != null)
            {
                ITypeElement typeElement = constructor.GetContainingType();
                if (typeElement != null)
                {
                    names.Add(typeElement.ShortName);
                }

                names.Add(DeclaredElementConstants.CONSTRUCTOR_NAME);
                return(names);
            }

            names.Add(element.ShortName);

            if (PsiDeclaredElementUtil.IsCollectionInitializerAddMethod(element))
            {
                names.Add("new");
            }

            if (PsiDeclaredElementUtil.IsForeachEnumeratorPatternMember(element))
            {
                names.Add("foreach");
            }

            if (DeclaredElementUtil.IsAsyncAwaitablePatternMember(element))
            {
                names.Add("async");
                names.Add("await");
            }

            // LINQ
            var method = element as IMethod;

            if (method != null)
            {
                if (method.ShortName == "Cast" && method.TypeParameters.Count == 1 && IsCorrectParametersNumberForQueryPatternMethod(method, 0))
                {
                    names.Add("from");
                }
                if (method.ShortName == "Select" && IsCorrectParametersNumberForQueryPatternMethod(method, 1))
                {
                    names.Add("from");
                }
                if (method.ShortName == "SelectMany" && IsCorrectParametersNumberForQueryPatternMethod(method, 2))
                {
                    names.Add("from");
                }
                if (method.ShortName == "Where" && IsCorrectParametersNumberForQueryPatternMethod(method, 1))
                {
                    names.Add("where");
                }
                if ((method.ShortName == "Join" || method.ShortName == "GroupJoin") && IsCorrectParametersNumberForQueryPatternMethod(method, 4))
                {
                    names.Add("join");
                }
                if ((method.ShortName == "OrderBy" || method.ShortName == "OrderByDescending" || method.ShortName == "ThenBy" || method.ShortName == "ThenByDescending") && IsCorrectParametersNumberForQueryPatternMethod(method, 1))
                {
                    names.Add("orderby");
                }
                if (method.ShortName == "GroupBy" && (IsCorrectParametersNumberForQueryPatternMethod(method, 1) || IsCorrectParametersNumberForQueryPatternMethod(method, 2)))
                {
                    names.Add("group");
                }
            }

            return(names);
        }
        public List <Dictionary <string, IAssetValue> > ImportUnityEventData(UnityEventsElementContainer elementContainer, JetHashSet <string> allUnityEventNames)
        {
            var result    = myScriptComponentHierarchy.ImportUnityEventData(elementContainer, allUnityEventNames);
            var patchData = GetImportedValuesForUnityEvent(Location, allUnityEventNames);

            var maxValue = patchData.Keys.Count == 0 ? 0 : patchData.Keys.Max();

            while (maxValue >= result.Count)
            {
                result.Add(new Dictionary <string, IAssetValue>());
            }

            foreach (var(i, patch) in patchData)
            {
                AssetUtils.Import(result[i], patch);
            }


            return(result);
        }
 static Processor()
 {
     // Also $injector.get and $injector.invoke
     InjectableNames = new JetHashSet<string> {"controller", "directive", "filter", "factory", "service", "provider", "animation" };
 }
Example #21
0
 protected override IEnumerable <ILookupItem> GetItemsFromResult(ICodeCompletionResult result, JetHashSet <ILookupItem> best)
 {
     return(base.GetItemsFromResult(result, best).OfType <ReflectionMemberLookupItem>());
 }
Example #22
0
        /// <summary>
        /// This code changes PSI documents. It is executed usder PSI transaction, Command cookies, Reentrancy guard ets.
        /// All documents are committed (PSI is valid).
        /// </summary>
        public override bool Execute(IProgressIndicator pi)
        {
            pi.Start(6);

            //check if data stored in workflow is valid...
            Method    = Workflow.MethodPointer.FindDeclaredElement();
            Parameter = Workflow.ParameterPointer.FindDeclaredElement();

            if (Method == null || Parameter == null)
            {
                return(false);
            }

            IPsiServices services = Parameter.GetPsiServices();

            IReference[] referencesToParameter;
            IReference[] referencesToRootOverrides;

            // search for method overrides (OverridesFinder is util class that
            // allows to find all overrides and problems with quasi implementations)
            OverridesFinder overridesFinder = OverridesFinder.CreateInstance(Method);

            using (var subPi = new SubProgressIndicator(pi, 1))
                overridesFinder.Find(subPi);

            JetHashSet <HierarchyMember> hierarchyMembers = overridesFinder.Overrides;

            List <IMethod>    methods    = ScanHierarchyConflicts(hierarchyMembers).ToList();
            List <IParameter> parameters = GetAllParameters(methods).ToList();

            // find parameters and methods usages...
            using (var subPi = new SubProgressIndicator(pi, 1))
            {
                subPi.TaskName = "Searching parameter usages:";
                IEnumerable <IPsiSourceFile> projectFiles = from param in parameters
                                                            let projectFilesOfOneParameter = param.GetSourceFiles()
                                                                                             from projectFile in projectFilesOfOneParameter
                                                                                             select projectFile;
                ISearchDomain searchDomain = mySearchDomainFactory.CreateSearchDomain(projectFiles.ToList());
                referencesToParameter = services.Finder.FindReferences(parameters, searchDomain, subPi);
            }

            using (var subPi = new SubProgressIndicator(pi, 1))
            {
                subPi.TaskName            = "Searching method usages:";
                referencesToRootOverrides = services.Finder.FindReferences(methods,
                                                                           mySearchDomainFactory.CreateSearchDomain(Solution,
                                                                                                                    false), subPi);
            }

            // this step processes method usages, removes argument and stores reference specific data to the 'MethodInvocation'.
            List <MethodInvocation> usages;

            using (var subPi = new SubProgressIndicator(pi, 1))
                usages = PreProcessMethodUsages(referencesToRootOverrides, subPi).ToList();

            // replace usages of parameters with typeof(TNewTypeParameter) expression.
            using (var subPi = new SubProgressIndicator(pi, 1))
                ProcessParameterUsages(referencesToParameter, subPi);

            // Remove parameters from method declarations and insert new type parmeter. Map contains method -> new type parameter relation.
            Dictionary <IMethod, ITypeParameter> map = UpdateDeclarations(methods);

            // We have changed declarations. cashes should be updated)
            PsiManager.GetInstance(Solution).UpdateCaches();

            // Process method usages one more time to insert correct type arguments to the call.
            using (var subPi = new SubProgressIndicator(pi, 1))
                BindUsages(usages, map, subPi);

            return(true);
        }
        public void Execute(IDataContext context, DelegateExecute nextExecute)
        {
            var solution = context.GetData(ProjectModelDataConstants.SOLUTION);

            if (solution == null)
            {
                return;
            }

            var wordsPerAssembly = new OneToSetMap <string, string>(valueComparer: StringComparer.InvariantCultureIgnoreCase);
            var abbreviations    = new JetHashSet <string>();

            // TODO: This should be in a background task
            var psiModules  = solution.GetComponent <IPsiModules>();
            var symbolCache = solution.GetComponent <ISymbolCache>();

            foreach (var assemblyPsiModule in psiModules.GetAssemblyModules().OrderBy(m => m.DisplayName))
            {
                if (!ShouldProcessAssembly(assemblyPsiModule))
                {
                    continue;
                }

                var symbolScope  = symbolCache.GetSymbolScope(assemblyPsiModule, false, true);
                var typeElements = symbolScope.GetAllTypeElementsGroupedByName();
                foreach (var typeElement in typeElements)
                {
                    if (!typeElement.CanBeVisibleToSolution())
                    {
                        continue;
                    }

                    AddWords(wordsPerAssembly, abbreviations, assemblyPsiModule, typeElement.ShortName);

                    foreach (var namespaceName in typeElement.GetClrName().NamespaceNames)
                    {
                        AddWords(wordsPerAssembly, abbreviations, assemblyPsiModule, namespaceName);
                    }

                    // TODO: Should we skip enum values?
                    // It's unlikely that a user would name a method or variable after a value such as AdvertisingNetwork.Aarki,
                    // but on the other hand, if it's used in a comment, it'll show up as a typo.

                    foreach (var typeMember in typeElement.GetMembers())
                    {
                        if (!ShouldProcessTypeMember(typeMember))
                        {
                            continue;
                        }

                        if (typeElement is IEnum)
                        {
                            // Don't use any enum values as abbreviations. Avoids false positives with ALL_UPPER_CASE style
                            AddWords(wordsPerAssembly, new JetHashSet <string>(), assemblyPsiModule,
                                     typeMember.ShortName);
                        }
                        else
                        {
                            AddWords(wordsPerAssembly, abbreviations, assemblyPsiModule, typeMember.ShortName);
                        }

                        // TODO: Include parameter names?
                        // Respeller will not check parameter names of overriding or implementing functions, so this is
                        // probably unnecessary
                    }
                }
            }

            // Case insensitive. There will not be duplicates
            var allWords = (from pair in wordsPerAssembly
                            from word in pair.Value
                            select word).ToJetHashSet(StringComparer.InvariantCultureIgnoreCase);

            var spellService = solution.GetComponent <ISpellService>();

            var unknownWords = (from word in allWords
                                where !spellService.CheckWordSpelling(word)
                                select word).ToJetHashSet(StringComparer.InvariantCultureIgnoreCase);

            // Add abbreviations separately. If added to the dictionary, we don't get typo warnings, but we can get
            // naming standard inspection warnings. E.g. BlahBlahAABB is converted to BlahBlahAabb. Don't add anything
            // that's already known, but the spell checker will only check for words of 4 characters or more.
            // TODO: Ideally, we should disable AbbreviationsSettingsProvider. But just merge results in for now
            var unknownAbbreviations = (from word in abbreviations
                                        where (word.Length > 1 && word.Length < 4) || !spellService.CheckWordSpelling(word)
                                        select word).ToJetHashSet();

            // Remove the non-abbreviations
            unknownAbbreviations.Remove("TEXTMESHPRO");
            unknownAbbreviations.Remove("GRAIDENT");

            // Remove known typos or exclusions. Yes, this is all done by hand
            RemoveTyposAndExclusions(unknownWords);

            // Dump all words for diagnostics
            Dumper.DumpToNotepad(w =>
            {
                w.WriteLine("All words");
                w.WriteLine();

                foreach (var(assembly, words) in wordsPerAssembly)
                {
                    w.WriteLine("Words for assembly: " + assembly);
                    w.WriteLine();

                    foreach (var word in words.OrderBy(IdentityFunc <string> .Instance))
                    {
                        w.WriteLine(word.ToLowerInvariant());
                    }
                    w.WriteLine();
                }
            });

            // Dump all abbreviations, so we can avoid naming standards inspections when an abbreviation is used.
            // E.g. BlahBlahAABB is accepted instead of converted to BlahBlahAabb
            Dumper.DumpToNotepad(w =>
            {
                w.WriteLine("Abbreviations");
                w.WriteLine();

                foreach (var abbreviation in unknownAbbreviations.OrderBy(IdentityFunc <string> .Instance))
                {
                    w.WriteLine(abbreviation.ToUpperInvariant());
                }
            });

            // Dump all unknown words, minus abbreviations, for use as a dictionary
            Dumper.DumpToNotepad(w =>
            {
                var dictionary = new JetHashSet <string>(unknownWords, StringComparer.InvariantCultureIgnoreCase);
                dictionary.ExceptWith(abbreviations);

                w.WriteLine("Dictionary (unknown words minus abbreviations)");
                w.WriteLine();
                w.WriteLine(dictionary.Count);    // Hunspell dictionaries start with the number of words

                foreach (var word in dictionary.OrderBy(IdentityFunc <string> .Instance))
                {
                    w.WriteLine(word.ToLowerInvariant());
                }
            });
        }
    public IEnumerable<string> GetAllPossibleWordsInFile(IDeclaredElement element)
    {
      var names = new JetHashSet<string>();

      var constructor = element as IConstructor;
      if (constructor != null)
      {
        ITypeElement typeElement = constructor.GetContainingType();
        if (typeElement != null)
        {
          names.Add(typeElement.ShortName);
        }

        names.Add(DeclaredElementConstants.CONSTRUCTOR_NAME);
        return names;
      }

      names.Add(element.ShortName);

      if (PsiDeclaredElementUtil.IsCollectionInitializerAddMethod(element))
      {
        names.Add("new");
      }

      if (PsiDeclaredElementUtil.IsForeachEnumeratorPatternMember(element))
      {
        names.Add("foreach");
      }

      if (DeclaredElementUtil.IsAsyncAwaitablePatternMember(element))
      {
        names.Add("async");
        names.Add("await");
      }

      // LINQ
      var method = element as IMethod;
      if (method != null)
      {
        if (method.ShortName == "Cast" && method.TypeParameters.Count == 1 && IsCorrectParametersNumberForQueryPatternMethod(method, 0))
        {
          names.Add("from");
        }
        if (method.ShortName == "Select" && IsCorrectParametersNumberForQueryPatternMethod(method, 1))
        {
          names.Add("from");
        }
        if (method.ShortName == "SelectMany" && IsCorrectParametersNumberForQueryPatternMethod(method, 2))
        {
          names.Add("from");
        }
        if (method.ShortName == "Where" && IsCorrectParametersNumberForQueryPatternMethod(method, 1))
        {
          names.Add("where");
        }
        if ((method.ShortName == "Join" || method.ShortName == "GroupJoin") && IsCorrectParametersNumberForQueryPatternMethod(method, 4))
        {
          names.Add("join");
        }
        if ((method.ShortName == "OrderBy" || method.ShortName == "OrderByDescending" || method.ShortName == "ThenBy" || method.ShortName == "ThenByDescending") && IsCorrectParametersNumberForQueryPatternMethod(method, 1))
        {
          names.Add("orderby");
        }
        if (method.ShortName == "GroupBy" && (IsCorrectParametersNumberForQueryPatternMethod(method, 1) || IsCorrectParametersNumberForQueryPatternMethod(method, 2)))
        {
          names.Add("group");
        }
      }

      return names;
    }
        public List <Dictionary <string, IAssetValue> > ImportUnityEventData(UnityEventsElementContainer elementContainer, JetHashSet <string> allUnityEventNames)
        {
            var unityEvents = elementContainer.GetUnityEventDataFor(Location, allUnityEventNames);

            var result = new List <Dictionary <string, IAssetValue> >();

            foreach (var unityEventData in unityEvents)
            {
                for (int i = 0; i < unityEventData.Calls.Count; i++)
                {
                    var dictionary = unityEventData.Calls[i].ToDictionary();
                    if (i < result.Count)
                    {
                        AssetUtils.Import(result[i], dictionary);
                    }
                    else
                    {
                        Assertion.Assert(result.Count == i, "result.Count == i");
                        result.Add(dictionary);
                    }
                }
            }
            return(result);
        }
Example #26
0
        private void ProcessDirective([NotNull] IT4Directive directive)
        {
            IT4Token nameToken = directive.GetNameToken();
            if (nameToken == null)
                return;

            DirectiveInfo directiveInfo = _directiveInfoManager.GetDirectiveByName(nameToken.GetText());
            if (directiveInfo == null)
                return;

            // Notify of missing required attributes.
            IEnumerable<string> attributeNames = directive.GetAttributes().SelectNotNull(attr => attr.GetName());
            var hashSet = new JetHashSet<string>(attributeNames, StringComparer.OrdinalIgnoreCase);
            foreach (DirectiveAttributeInfo attributeInfo in directiveInfo.SupportedAttributes) {
                if (attributeInfo.IsRequired && !hashSet.Contains(attributeInfo.Name)) {
                    AddHighlighting(new HighlightingInfo(nameToken.GetHighlightingRange(),
                        new MissingRequiredAttributeHighlighting(nameToken, attributeInfo.Name)));
                }
            }

            // Assembly attributes in preprocessed templates are useless.
            if (directiveInfo == _directiveInfoManager.Assembly && DaemonProcess.SourceFile.ToProjectFile().IsPreprocessedT4Template()) {
                AddHighlighting(new HighlightingInfo(directive.GetHighlightingRange(), new IgnoredAssemblyDirectiveHighlighting(directive)));
            }
        }
Example #27
0
 private void SetInterestingReferences(params string[] names)
 {
     acceptableReferenceNames = new JetHashSet <string>(names);
 }
        private static void CheckMethodGroup(
            [NotNull] IReferenceExpression methodReference,
            [NotNull] IMethod method, [NotNull] IHighlightingConsumer consumer)
        {
            string message    = null;
            var    methodType = method.GetContainingType();

            if (methodType is IInterface)
            {
                message = string.Format("from interface '{0}' method", methodType.ShortName);
                consumer.AddHighlighting(
                    new SlowDelegateCreationHighlighting(methodReference, message),
                    methodReference.GetExpressionRange());
                return;
            }

            // there is not lags if method is instance method
            if (!method.IsStatic &&
                methodReference.QualifierExpression != null &&
                methodReference.QualifierExpression.IsClassifiedAsVariable)
            {
                return;
            }

            var substitution   = methodReference.Reference.Resolve().Result.Substitution;
            var typeParameters = new JetHashSet <ITypeParameter>();

            // collect all the type parameters from the method reference
            if (!substitution.IsEmpty())
            {
                foreach (var typeParameter in substitution.Domain)
                {
                    var substitutionType = substitution.Apply(typeParameter);
                    var targs            = TypeParametersCollectingVisitor.Collect(substitutionType);
                    typeParameters.UnionWith(targs);
                }
            }

            // get the delegate creation owner type, if member is not static
            var delegateCreationMember = methodReference.GetContainingTypeMemberDeclaration();

            if (delegateCreationMember == null || delegateCreationMember.DeclaredElement == null)
            {
                return;
            }

            ITypeElement delegateCreationOwnerType = null;

            if (!delegateCreationMember.DeclaredElement.IsStatic)
            {
                delegateCreationOwnerType = delegateCreationMember.DeclaredElement.GetContainingType();
            }

            // look for implicit qualification with the type parameters
            ITypeElement lastType = null;

            for (var qualifier = methodReference; qualifier != null;
                 qualifier = qualifier.QualifierExpression as IReferenceExpression)
            {
                if (qualifier.IsClassifiedAsVariable)
                {
                    lastType = null;
                    break;
                }

                var resolveResult = qualifier.Reference.Resolve();
                lastType = resolveResult.DeclaredElement as ITypeElement;
            }

            if (lastType != null)
            {
                for (var hidden = lastType.GetContainingType(); hidden != null; hidden = hidden.GetContainingType())
                {
                    if (hidden.TypeParameters.Count > 0)
                    {
                        foreach (var typeParameter in hidden.TypeParameters)
                        {
                            typeParameters.Add(typeParameter);
                        }
                    }
                }
            }

            foreach (var parameter in typeParameters)
            {
                if (parameter.IsValueType)
                {
                    continue;
                }

                if (delegateCreationOwnerType != null &&
                    delegateCreationOwnerType.TypeParameters.Contains(parameter))
                {
                    continue;
                }

                if (message == null)
                {
                    message = "method group parametrized with type parameter ";
                }

                if (parameter.OwnerType != null)
                {
                    message += string.Format("'{0}' of type '{1}'", parameter.ShortName, parameter.OwnerType.ShortName);
                }
                else if (parameter.OwnerMethod != null)
                {
                    message += string.Format("'{0}' of method '{1}'", parameter.ShortName, parameter.OwnerMethod.ShortName);
                }
            }

            if (message != null)
            {
                consumer.AddHighlighting(
                    new SlowDelegateCreationHighlighting(methodReference, message),
                    methodReference.GetExpressionRange());
            }
        }
 private bool IsOverridingTag(string name)
 {
     // This is horrible. We can't override existing tags and attributes, but we calling the
     // other providers dynamically causes serious perf issues. We'll just make do with
     // caching the standard HTML attributes and hope for the best. We also can't do this
     // in the constructor, or we get a nasty circular instantiation issue. I'll file a YT
     // ticket to handle this better in a future version.
     if (allTags == null)
     {
         lock (lockObject)
         {
             if (allTags == null)
             {
                 allTags = standardProvider.GetAllTagsSymbolTable().Names().ToHashSet(IdentityFunc<string>.Instance, StringComparer.InvariantCultureIgnoreCase);
             }
         }
     }
     return allTags.Contains(name);
 }
 private void SetInterestingReferences(params string[] names)
 {
     acceptableReferenceNames = new JetHashSet<string>(names);
 }
Example #31
0
        private void ProcessDirective([NotNull] IT4Directive directive)
        {
            IT4Token nameToken = directive.GetNameToken();
            if (nameToken == null)
                return;

            DirectiveInfo directiveInfo = _directiveInfoManager.GetDirectiveByName(nameToken.GetText());
            if (directiveInfo == null)
                return;

            IEnumerable<string> attributeNames = directive.GetAttributes().SelectNotNull(attr => attr.GetName());
            var hashSet = new JetHashSet<string>(attributeNames, StringComparer.OrdinalIgnoreCase);
            foreach (DirectiveAttributeInfo attributeInfo in directiveInfo.SupportedAttributes) {
                if (attributeInfo.IsRequired && !hashSet.Contains(attributeInfo.Name)) {
                    AddHighlighting(new HighlightingInfo(nameToken.GetHighlightingRange(),
                        new MissingRequiredAttributeHighlighting(nameToken, attributeInfo.Name)));
                }
            }
        }
Example #32
0
 public ProjectSettingsCacheItem(ProjectSettingsSceneData sceneData = null,
                                 JetHashSet <string> inputs         = null, JetHashSet <string> tags = null, JetHashSet <string> layers = null)
 {
     Scenes = sceneData ?? new ProjectSettingsSceneData();
     Inputs = inputs ?? new JetHashSet <string>();
     Tags   = tags ?? new JetHashSet <string>();
     Layers = layers ?? new JetHashSet <string>();
 }
        private static void ReportClosureAllocations(
            [NotNull] ITreeNode topDeclaration, [CanBeNull] IFunction thisElement, [CanBeNull] ILocalScope topScope,
            [NotNull] ClosureInspector inspector, [NotNull] IHighlightingConsumer consumer)
        {
            var scopesMap     = new Dictionary <IDeclaredElement, ILocalScope>();
            var captureScopes = new Dictionary <ILocalScope, JetHashSet <IDeclaredElement> >();

            // group captures by their scope, report non-cached delegates
            foreach (var closure in inspector.Closures)
            {
                foreach (var capture in closure.Value)
                {
                    ILocalScope scope = null;
                    if (capture is IFunction)
                    {
                        scope = topScope;             // 'this' capture
                    }
                    else
                    {
                        var declarations = capture.GetDeclarations();
                        if (declarations.Count == 0) // accessors 'value' parameter
                        {
                            var accessor = thisElement as IAccessor;
                            if (accessor != null && Equals(accessor.ValueVariable, capture))
                            {
                                scope = topScope;
                            }
                        }
                        else
                        {
                            foreach (var declaration in declarations)
                            {
                                if (declaration is IRegularParameterDeclaration)
                                {
                                    scope = topScope;
                                }
                                else
                                {
                                    scope = declaration.GetContainingNode <ILocalScope>();
                                }
                                break;
                            }
                        }
                    }

                    if (scope == null)
                    {
                        continue;
                    }

                    JetHashSet <IDeclaredElement> captures;
                    if (!captureScopes.TryGetValue(scope, out captures))
                    {
                        captureScopes[scope] = captures = new JetHashSet <IDeclaredElement>();
                    }

                    captures.Add(capture);
                    scopesMap[capture] = scope;
                }


                {
                    var highlightingRange = GetClosureRange(closure.Key);
                    if (highlightingRange.IsValid())
                    {
                        if (IsExpressionLambda(closure.Key))
                        {
                            consumer.AddHighlighting(
                                new ObjectAllocationHighlighting(closure.Key, "expression tree construction"),
                                highlightingRange);
                        }
                        else
                        {
                            consumer.AddHighlighting(
                                new DelegateAllocationHighlighting(closure.Key, "capture of " + FormatClosureDescription(closure.Value)),
                                highlightingRange);
                        }
                    }
                }
            }

            // highlight first captured entity per every scope
            foreach (var scopeToCaptures in captureScopes)
            {
                var firstOffset = TreeOffset.MaxValue;
                IDeclaredElement firstCapture = null;

                foreach (var capture in scopeToCaptures.Value)
                {
                    if (capture is IFunction)
                    {
                        continue;
                    }

                    var offset = GetCaptureStartOffset(capture);
                    if (offset < firstOffset)
                    {
                        firstOffset  = offset;
                        firstCapture = capture;
                    }
                }

                var scopeClosure = FormatClosureDescription(scopeToCaptures.Value);

                // collect outer captures
                JetHashSet <IDeclaredElement> outerCaptures = null;
                foreach (var closureToCaptures in inspector.Closures)
                {
                    if (!scopeToCaptures.Key.Contains(closureToCaptures.Key))
                    {
                        continue;
                    }
                    foreach (var capture in closureToCaptures.Value)
                    {
                        ILocalScope scope;
                        if (!scopesMap.TryGetValue(capture, out scope))
                        {
                            continue;
                        }
                        if (scopeToCaptures.Key.Contains(scope))
                        {
                            continue;
                        }

                        outerCaptures = outerCaptures ?? new JetHashSet <IDeclaredElement>();
                        outerCaptures.Add(capture);
                    }
                }

                if (outerCaptures != null)
                {
                    scopeClosure += string.Format(" + (outer closure of {0})", FormatClosureDescription(outerCaptures));
                }

                if (firstCapture != null)
                {
                    DocumentRange highlightingRange;
                    var           anchor = GetCaptureHighlightingRange(
                        topDeclaration, thisElement, firstCapture, out highlightingRange);
                    if (anchor != null && highlightingRange.IsValid())
                    {
                        consumer.AddHighlighting(
                            new ClosureAllocationHighlighting(anchor, scopeClosure),
                            highlightingRange);
                    }
                }
            }
        }
 // Возвращает множество существующих статусов для каждой переменной, определенной хотя бы в одном прердыдущей элементе.
 // Если хотя бы один предыдущий элемент еще не посещался, то множество статусов для всех переменных будет содержать
 // еще и статус Unknown.
 // previousElems должен содержать null для элементов, у которых нет еще СontrolFlowElementData или которые не посещались.
 private IDictionary<IVariableDeclaration, JetHashSet<VariableDisposeStatus>> GetPreviousElemsStatusSetsList(ICollection<ControlFlowElementData> previousElems)
 {
     var previousWithoutNotVisitedElements = previousElems.Where(e => e != null && e.IsVisited()).ToList();
     var result = new Dictionary<IVariableDeclaration, JetHashSet<VariableDisposeStatus>>();
     foreach (var status in previousWithoutNotVisitedElements.SelectMany(data => data.Status))
     {
         JetHashSet<VariableDisposeStatus> statusSet;
         var hasValue = result.TryGetValue(status.Key, out statusSet);
         if (hasValue)
             statusSet.Add(status.Value);
         else
         {
             statusSet = new JetHashSet<VariableDisposeStatus> {status.Value};
             result[status.Key] = statusSet;
         }
     }
     var hasNotVisitedElements = previousElems.Count != previousWithoutNotVisitedElements.Count;
     if (hasNotVisitedElements)
         result.ForEach(kvp => kvp.Value.Add(VariableDisposeStatus.Unknown));
     return result;
 }
        public UnityEditorProtocol(Lifetime lifetime, ILogger logger, UnityHost host,
                                   IScheduler dispatcher, IShellLocks locks, ISolution solution,
                                   ISettingsStore settingsStore, JetBrains.Application.ActivityTrackingNew.UsageStatistics usageStatistics,
                                   UnitySolutionTracker unitySolutionTracker, IThreading threading,
                                   UnityVersion unityVersion, NotificationsModel notificationsModel,
                                   IHostProductInfo hostProductInfo)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myComponentLifetime  = lifetime;
            myLogger             = logger;
            myDispatcher         = dispatcher;
            myLocks              = locks;
            mySolution           = solution;
            myUsageStatistics    = usageStatistics;
            myThreading          = threading;
            myUnityVersion       = unityVersion;
            myNotificationsModel = notificationsModel;
            myHostProductInfo    = hostProductInfo;
            myHost = host;
            myBoundSettingsStore = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));
            mySessionLifetimes   = new SequentialLifetimes(lifetime);

            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            unitySolutionTracker.IsUnityProject.View(lifetime, (lf, args) =>
            {
                if (!args)
                {
                    return;
                }

                var solFolder = mySolution.SolutionDirectory;
                AdviseModelData(lifetime);

                // todo: consider non-Unity Solution with Unity-generated projects
                var protocolInstancePath = solFolder.Combine("Library/ProtocolInstance.json");
                protocolInstancePath.Directory.CreateDirectory();

                var watcher          = new FileSystemWatcher();
                watcher.Path         = protocolInstancePath.Directory.FullPath;
                watcher.NotifyFilter = NotifyFilters.LastWrite; //Watch for changes in LastWrite times
                watcher.Filter       = protocolInstancePath.Name;

                // Add event handlers.
                watcher.Changed += OnChanged;
                watcher.Created += OnChanged;

                lf.Bracket(() => { }, () =>
                {
                    watcher.Dispose();
                });

                watcher.EnableRaisingEvents = true; // Begin watching.
                // connect on start of Rider
                CreateProtocols(protocolInstancePath);
            });
        }
 private JetHashSet<VariableDisposeStatus> GetPreviousElemsThisStatusSet(
     IEnumerable<ControlFlowElementData> previousElems)
 {
     var result = new JetHashSet<VariableDisposeStatus>();
     foreach (var previousElementData in previousElems)
     {
         if (previousElementData == null || !previousElementData.IsVisited())
             result.Add(VariableDisposeStatus.Unknown);
         else
         {
             if (previousElementData.ThisStatus == null)
                 return null;
             result.Add(previousElementData.ThisStatus.Value);
         }
     }
     return result;
 }
 public TextOccurencesCollector(JetHashSet <string> texts, IFindResultConsumer <TResult> consumer)
 {
     myTexts    = texts;
     myConsumer = consumer;
 }
 // На основе множества статусов вычисляет один.
 // (Для группы равноправных элементов, например, всех предыдущих элементов)
 private VariableDisposeStatus UniteStatus(JetHashSet<VariableDisposeStatus> statusSet, bool hasCrossroads)
 {
     var disposedAndInvocationSet = new List<VariableDisposeStatus>
     {
         VariableDisposeStatus.Disposed,
         VariableDisposeStatus.DependsOnInvocation
     };
     if (statusSet.IsSupersetOf(disposedAndInvocationSet))
         return VariableDisposeStatus.Disposed;
     if (statusSet.Contains(VariableDisposeStatus.DependsOnInvocation))
         return VariableDisposeStatus.DependsOnInvocation;
     var bothSet = new List<VariableDisposeStatus>
     {
         VariableDisposeStatus.Disposed,
         VariableDisposeStatus.NotDisposed
     };
     if (statusSet.Contains(VariableDisposeStatus.Both) || statusSet.IsSupersetOf(bothSet))
         return VariableDisposeStatus.Both;
     if (!hasCrossroads)
     {
         if (statusSet.Contains(VariableDisposeStatus.Disposed))
             return VariableDisposeStatus.Disposed;
         if (statusSet.Contains(VariableDisposeStatus.NotDisposed))
             return VariableDisposeStatus.NotDisposed;
         Assertion.Fail("Unknown status");
         return VariableDisposeStatus.Unknown;
     }
     if (statusSet.Contains(VariableDisposeStatus.Unknown))
         return VariableDisposeStatus.Unknown;
     if (statusSet.Contains(VariableDisposeStatus.Disposed))
         return VariableDisposeStatus.Disposed;
     return VariableDisposeStatus.NotDisposed;
 }
Example #39
0
 public CgSyntaxHighlightingStage(CgSupportSettings cgSupportSettings)
 {
     myCgSupportSettings = cgSupportSettings;
     mySemantics         = CreateSemanticsSet();
 }
 public void SetCategories(JetHashSet <string> categories)
 {
     Categories = UnitTestElementCategory.Create(categories);
 }