Beispiel #1
0
        private async Task <bool> TryApplySignatureHelpAsync(ISignatureHelpProviderWrapper provider, SignatureHelpTriggerInfoData trigger, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken, bool sendIfEmpty = false)
        {
            // ReSharper disable once PossibleInvalidOperationException
            if (trigger.TriggerReason == SignatureHelpTriggerReason.TypeCharCommand && !provider.IsTriggerCharacter(trigger.TriggerCharacter.Value))
            {
                return(false);
            }

            var help = await provider.GetItemsAsync(session.Roslyn.Document, session.CursorPosition, trigger, cancellationToken).ConfigureAwait(false);

            if (!sendIfEmpty && help == null)
            {
                return(false);
            }

            session.Roslyn.CurrentSignatureHelp = help != null ? new CurrentSignatureHelp(provider, help) : (CurrentSignatureHelp?)null;
            await SendSignatureHelpAsync(help, sender, cancellationToken).ConfigureAwait(false);

            return(true);
        }
 public CurrentSignatureHelp(ISignatureHelpProviderWrapper provider, SignatureHelpItemsData items)
 {
     Provider = provider;
     Items    = items;
 }