protected async void CreateCompletionData(CompletionContext context, SemanticModel semanticModel, int position, ITypeSymbol returnType, Accessibility seenAccessibility, SyntaxToken startToken, SyntaxToken tokenBeforeReturnType, bool afterKeyword, CancellationToken cancellationToken)
        {
            if (!TryDetermineOverridableProtocolMembers(semanticModel, tokenBeforeReturnType, seenAccessibility, out ISet <ISymbol> overridableMembers, cancellationToken))
            {
                return;
            }
            if (returnType != null)
            {
                overridableMembers = FilterOverrides(overridableMembers, returnType);
            }
            var currentType      = semanticModel.GetEnclosingSymbolMD <INamedTypeSymbol> (startToken.SpanStart, cancellationToken);
            var declarationBegin = afterKeyword ? startToken.SpanStart : position - 1;

            foreach (var m in overridableMembers)
            {
                var  pDict      = ImmutableDictionary <string, string> .Empty;
                bool isExplicit = false;
                //			if (member.DeclaringTypeDefinition.Kind == TypeKind.Interface) {
                //				foreach (var m in type.Members) {
                //					if (m.Name == member.Name && !m.ReturnType.Equals (member.ReturnType)) {
                //						isExplicit = true;
                //						break;
                //					}
                //				}
                //			}
                //			var resolvedType = type.Resolve (ext.Project).GetDefinition ();
                //			if (ext.Project != null)
                //				generator.PolicyParent = ext.Project.Policies;

                var    result    = CSharpCodeGenerator.CreateProtocolMemberImplementation(null, null, currentType, currentType.Locations.First(), m, isExplicit, semanticModel);
                string sb        = result.Code.TrimStart();
                int    trimStart = result.Code.Length - sb.Length;
                sb = sb.TrimEnd();

                var lastRegion = result.BodyRegions.LastOrDefault();
                var region     = lastRegion == null ? null
                                        : new CodeGeneratorBodyRegion(lastRegion.StartOffset - trimStart, lastRegion.EndOffset - trimStart);

                var inlineDescription = GettextCatalog.GetString("Implement protocol member");
                pDict = pDict.Add("InsertionText", sb.ToString());
                pDict = pDict.Add("DescriptionMarkup", "- <span foreground=\"darkgray\" size='small'>" + inlineDescription + "</span>");
                pDict = pDict.Add("Description", await GenerateQuickInfo(semanticModel, position, m, cancellationToken));
                pDict = pDict.Add("DeclarationBegin", declarationBegin.ToString());

                var tags = ImmutableArray <string> .Empty.Add("NewMethod");

                var completionData = CompletionItem.Create(m.Name, sortText: m.ToSignatureDisplayString(), properties: pDict, rules: ProtocolCompletionRules, tags: tags, inlineDescription: inlineDescription);
                context.AddItem(completionData);
            }
        }
        static bool TryDetermineOverridableProtocolMembers(SemanticModel semanticModel, SyntaxToken startToken, Accessibility seenAccessibility, out ISet <ISymbol> overridableMembers, CancellationToken cancellationToken)
        {
            var result         = new HashSet <ISymbol> ();
            var containingType = semanticModel.GetEnclosingSymbolMD <INamedTypeSymbol> (startToken.SpanStart, cancellationToken);

            if (containingType != null && !containingType.IsScriptClass && !containingType.IsImplicitClass)
            {
                if (containingType.TypeKind == TypeKind.Class || containingType.TypeKind == TypeKind.Struct)
                {
                    var baseTypes = containingType.GetBaseTypesMD().Reverse().Concat(containingType.AllInterfaces);
                    foreach (var type in baseTypes)
                    {
                        if (cancellationToken.IsCancellationRequested)
                        {
                            overridableMembers = null;
                            return(false);
                        }


                        // Prefer overrides in derived classes
                        // RemoveOverriddenMembers (result, type, cancellationToken);

                        // Retain overridable methods
                        AddProtocolMembers(semanticModel, result, type, cancellationToken);
                    }
                    // Don't suggest already overridden members
                    // RemoveOverriddenMembers (result, containingType, cancellationToken);
                }
            }

            // Filter based on accessibility
            if (seenAccessibility != Accessibility.NotApplicable)
            {
                result.RemoveWhere(m => m.DeclaredAccessibility != seenAccessibility);
            }


            // Filter members that are already overriden - they're already part of 'override completion'
            //ISet<ISymbol> realOverridableMembers;
            //if (OverrideContextHandler.TryDetermineOverridableMembers (semanticModel, startToken, seenAccessibility, out realOverridableMembers, cancellationToken)) {
            //	result.RemoveWhere (m => realOverridableMembers.Any (m2 => IsEqualMember (m, m2)));
            //}

            overridableMembers = result;
            return(overridableMembers.Count > 0);
        }