private IList<ILookupItem> CollectAvailableTemplates(
      [NotNull] ITreeNode reference, [NotNull] ICSharpExpression expression,
      DocumentRange replaceRange, bool forceMode, [NotNull] PostfixExecutionContext context)
        {
            var postfixContext = new PostfixTemplateAcceptanceContext(
            reference, expression, replaceRange, forceMode, context);

              if (postfixContext.Expressions.Count == 0)
            return EmptyList<ILookupItem>.InstanceList;

              var store = expression.GetSettingsStore();
              var settings = store.GetKey<PostfixCompletionSettings>(SettingsOptimization.OptimizeDefault);
              settings.DisabledProviders.SnapshotAndFreeze();

              var isTypeExpression = postfixContext.InnerExpression.ReferencedElement is ITypeElement;
              var items = new List<ILookupItem>();

              var templateName = context.SpecificTemplateName;
              foreach (var info in myTemplateProvidersInfos)
              {
            bool isEnabled;
            if (!settings.DisabledProviders.TryGet(info.SettingsKey, out isEnabled))
              isEnabled = !info.Metadata.DisabledByDefault;

            if (!isEnabled) continue; // check disabled providers

            if (templateName != null)
            {
              var name = info.Metadata.TemplateName;
              if (!string.Equals(templateName, name, StringComparison.Ordinal))
            continue;
            }

            if (isTypeExpression && !info.Metadata.WorksOnTypes) continue;

            info.Provider.CreateItems(postfixContext, items);
              }

              if (templateName != null) // do not like it
            items.RemoveAll(x => x.Identity != templateName);

              return items;
        }
        private IList<ILookupItem> CollectAvailableTemplates(
      [NotNull] IReferenceExpression reference, [NotNull] ICSharpExpression expression,
      TextRange replaceRange, TextRange expressionRange,
      bool canBeStatement, bool looseChecks, [CanBeNull] string templateName)
        {
            var acceptanceContext = new PostfixTemplateAcceptanceContext(
            reference, expression, replaceRange,
            expressionRange, canBeStatement, looseChecks);

              var store = expression.GetSettingsStore();
              var settings = store.GetKey<PostfixCompletionSettings>(SettingsOptimization.OptimizeDefault);
              settings.DisabledProviders.SnapshotAndFreeze();

              var isTypeExpression = acceptanceContext.ExpressionReferencedElement is ITypeElement;
              var items = new List<ILookupItem>();

              foreach (var info in myTemplateProvidersInfos)
              {
            bool isEnabled;
            if (settings.DisabledProviders.TryGet(info.SettingsKey, out isEnabled) && !isEnabled)
              continue; // check disabled providers

            if (templateName != null)
            {
              var templateNames = info.Metadata.TemplateNames;
              if (!templateNames.Contains(templateName, StringComparer.Ordinal))
            continue;
            }

            if (isTypeExpression && !info.Metadata.WorksOnTypes) continue;

            info.Provider.CreateItems(acceptanceContext, items);
              }

              if (templateName != null) // do not like it
            items.RemoveAll(x => x.Identity != templateName);

              return items;
        }