protected override Task <IEnumerable <CompletionData> > GetItemsWorkerAsync(CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken) { var document = completionContext.Document; var position = completionContext.Position; var semanticModel = ctx.SemanticModel; if (info.TriggerCharacter == '\\') { if (ctx.TargetToken.Parent != null && ctx.TargetToken.Parent.Parent != null && ctx.TargetToken.Parent.Parent.IsKind(SyntaxKind.Argument)) { var argument = ctx.TargetToken.Parent.Parent as ArgumentSyntax; var symbolInfo = semanticModel.GetSymbolInfo(ctx.TargetToken.Parent.Parent.Parent.Parent); if (symbolInfo.Symbol == null) { return(TaskUtil.EmptyEnumerable <CompletionData> ()); } if (SemanticHighlightingVisitor <int> .IsRegexMatchMethod(symbolInfo)) { if (((ArgumentListSyntax)argument.Parent).Arguments [1] != argument) { return(TaskUtil.EmptyEnumerable <CompletionData> ()); } completionResult.AutoSelect = false; return(Task.FromResult(GetFormatCompletionData(engine, argument.Expression.ToString() [0] == '@'))); } if (SemanticHighlightingVisitor <int> .IsRegexConstructor(symbolInfo)) { if (((ArgumentListSyntax)argument.Parent).Arguments [0] != argument) { return(TaskUtil.EmptyEnumerable <CompletionData> ()); } completionResult.AutoSelect = false; return(Task.FromResult(GetFormatCompletionData(engine, argument.Expression.ToString() [0] == '@'))); } } } else { var ma = ctx.TargetToken.Parent as MemberAccessExpressionSyntax; if (ma != null) { var symbolInfo = semanticModel.GetSymbolInfo(ma.Expression); var typeInfo = semanticModel.GetTypeInfo(ma.Expression); var type = typeInfo.Type; if (type != null && type.Name == "Match" && type.ContainingNamespace.GetFullName() == "System.Text.RegularExpressions") { var items = new List <CompletionData>(); foreach (var grp in GetGroups(ctx, symbolInfo.Symbol)) { items.Add(engine.Factory.CreateGenericData(this, "Groups[\"" + grp + "\"]", GenericDataType.Undefined)); } return(Task.FromResult((IEnumerable <CompletionData>)items)); } } } return(TaskUtil.EmptyEnumerable <CompletionData> ()); }