コード例 #1
0
        public static SignatureHelpSession TryCreate(SnapshotPoint triggerPosition, SignatureHelpTriggerInfo triggerInfo, Lazy <ISignatureHelpBroker> signatureHelpBroker, ITextView textView)
        {
            var info = SignatureHelpInfo.Create(triggerPosition.Snapshot);

            if (info == null)
            {
                return(null);
            }
            if (triggerInfo.TriggerReason == SignatureHelpTriggerReason.TypeCharCommand)
            {
                Debug.Assert(triggerInfo.TriggerCharacter != null);
                if (triggerInfo.TriggerCharacter != null && !info.Value.SignatureHelpService.IsTriggerCharacter(triggerInfo.TriggerCharacter.Value))
                {
                    return(null);
                }
            }
            else if (triggerInfo.TriggerReason == SignatureHelpTriggerReason.RetriggerCommand)
            {
                if (triggerInfo.TriggerCharacter != null && !info.Value.SignatureHelpService.IsRetriggerCharacter(triggerInfo.TriggerCharacter.Value))
                {
                    return(null);
                }
            }

            return(new SignatureHelpSession(info.Value.SignatureHelpService, signatureHelpBroker, textView));
        }
コード例 #2
0
        bool RestartCore(SnapshotPoint triggerPosition, SignatureHelpTriggerInfo triggerInfo)
        {
            var info = SignatureHelpInfo.Create(triggerPosition.Snapshot);

            if (info == null)
            {
                return(false);
            }

            Start(info.Value, triggerPosition, triggerInfo);
            return(true);
        }
コード例 #3
0
        void Start(SignatureHelpInfo info, SnapshotPoint triggerPosition, SignatureHelpTriggerInfo triggerInfo)
        {
            CancelFetchItems();
            Debug.Assert(cancellationTokenSource == null);
            cancellationTokenSource = new CancellationTokenSource();
            var cancellationTokenSourceTmp = cancellationTokenSource;

            StartAsync(info, triggerPosition, triggerInfo, cancellationTokenSource.Token)
            .ContinueWith(t => {
                var ex = t.Exception;
                // Free resources
                if (cancellationTokenSource == cancellationTokenSourceTmp)
                {
                    CancelFetchItems();
                }
            }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
        }
コード例 #4
0
        async Task StartAsync(SignatureHelpInfo info, SnapshotPoint triggerPosition, SignatureHelpTriggerInfo triggerInfo, CancellationToken cancellationToken)
        {
            // This helps a little to speed up the code
            ProfileOptimizationHelper.StartProfile("roslyn-sighelp-" + info.SignatureHelpService.Language);

            var result = await info.SignatureHelpService.GetItemsAsync(info.Document, triggerPosition.Position, triggerInfo, cancellationToken);

            if (result == null)
            {
                Dispose();
                return;
            }
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }
            StartSession(triggerPosition, result);
        }
コード例 #5
0
		async Task StartAsync(SignatureHelpInfo info, SnapshotPoint triggerPosition, SignatureHelpTriggerInfo triggerInfo, CancellationToken cancellationToken) {
			// This helps a little to speed up the code
			ProfileOptimizationHelper.StartProfile("roslyn-sighelp-" + info.SignatureHelpService.Language);

			var result = await info.SignatureHelpService.GetItemsAsync(info.Document, triggerPosition.Position, triggerInfo, cancellationToken);
			if (result == null) {
				Dispose();
				return;
			}
			if (cancellationToken.IsCancellationRequested)
				return;
			StartSession(triggerPosition, result);
		}
コード例 #6
0
		void Start(SignatureHelpInfo info, SnapshotPoint triggerPosition, SignatureHelpTriggerInfo triggerInfo) {
			CancelFetchItems();
			Debug.Assert(cancellationTokenSource == null);
			cancellationTokenSource = new CancellationTokenSource();
			var cancellationTokenSourceTmp = cancellationTokenSource;
			StartAsync(info, triggerPosition, triggerInfo, cancellationTokenSource.Token)
			.ContinueWith(t => {
				var ex = t.Exception;
				// Free resources
				if (cancellationTokenSource == cancellationTokenSourceTmp)
					CancelFetchItems();
			}, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
		}