コード例 #1
0
 static void AddItems(ImmutableArray <CompletionItem> items, CompletionContext completionContext, HashSet <string> namespacesInScope, TelemetryCounter counter)
 {
     foreach (var item in items)
     {
         var containingNamespace = TypeImportCompletionItem.GetContainingNamespace(item);
         if (!namespacesInScope.Contains(containingNamespace))
         {
             // We can return cached item directly, item's span will be fixed by completion service.
             // On the other hand, because of this (i.e. mutating the  span of cached item for each run),
             // the provider can not be used as a service by components that might be run in parallel
             // with completion, which would be a race.
             completionContext.AddItem(item);
             counter.ItemsCount++;;
         }
     }
 }
コード例 #2
0
            static void AddItems(TypeImportCompletionItemInfo itemInfo, bool isInternalsVisible, CompletionContext completionContext, HashSet <string> namespacesInScope)
            {
                if (itemInfo.IsPublic || isInternalsVisible)
                {
                    var containingNamespace = TypeImportCompletionItem.GetContainingNamespace(itemInfo.Item);
                    if (!namespacesInScope.Contains(containingNamespace))
                    {
                        // We can return cached item directly, item's span will be fixed by completion service.

                        // On the other hand, because of this (i.e. mutating the  span of cached item for each run),
                        // the provider can not be used as a service by components that might be run in parallel
                        // with completion, which would be a race.
                        completionContext.AddItem(itemInfo.Item);
                    }
                }
            }