Пример #1
0
 public static ITaggerEventSource OnCompletionClosed(
     ITextView textView,
     IIntellisenseSessionStack sessionStack,
     TaggerDelay delay)
 {
     return(new CompletionClosedEventSource(textView, sessionStack, delay));
 }
        protected virtual bool DismissAllCompletionSessions()
        {
            IntellisenseController controller = Controller;

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

            IIntellisenseSessionStack sessionStack = controller.IntellisenseSessionStack;

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

            ReadOnlyCollection <IIntellisenseSession> sessions = sessionStack.Sessions;

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

            List <ICompletionSession> completionSessions = new List <ICompletionSession>(sessions.OfType <ICompletionSession>());

            foreach (var session in completionSessions)
            {
                session.Dismiss();
            }

            return(completionSessions.Count > 0);
        }
        public IIntellisenseSessionStack GetStackForTextView(ITextView textView)
        {
            if (textView == null)
            {
                return(null);
            }

            IIntellisenseSessionStack stack = null;

            if (!textView.Properties.TryGetProperty <IIntellisenseSessionStack>(typeof(IIntellisenseSessionStack), out stack))
            {
                var wpfTextView = textView as IMdTextView;
                if (wpfTextView != null)
                {
                    stack = new IntellisenseSessionStack(wpfTextView, this.TipManager);

#if DEBUG
                    Helpers.TrackObject(this.ObjectTrackers, "Intellisense Session Stacks", stack);
#endif

                    wpfTextView.Properties.AddProperty(typeof(IIntellisenseSessionStack), stack);
                    wpfTextView.Closed += this.OnTextViewClosed;
                }
            }

            return(stack);
        }
        protected virtual bool AnySignatureHelpSessions()
        {
            IntellisenseController controller = Controller;

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

            IIntellisenseSessionStack sessionStack = controller.IntellisenseSessionStack;

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

            ReadOnlyCollection <IIntellisenseSession> sessions = sessionStack.Sessions;

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

            return(sessions.OfType <ISignatureHelpSession>().Any());
        }
Пример #5
0
 public static ITaggerEventSource OnCompletionClosed(
     ITextView textView,
     IIntellisenseSessionStack sessionStack,
     TaggerDelay delay)
 {
     return new CompletionClosedEventSource(textView, sessionStack, delay);
 }
Пример #6
0
 public PresenterMouseProcessor(IIntellisenseSessionStack intellisenseSessionStack)
 {
     if (intellisenseSessionStack == null)
     {
         throw new ArgumentNullException(nameof(intellisenseSessionStack));
     }
     this.intellisenseSessionStack = intellisenseSessionStack;
 }
Пример #7
0
 public EditFilter(System.IServiceProvider serviceProvider, ITextView textView, IEditorOperations editorOps, IEditorOptions editorOptions, IIntellisenseSessionStack intellisenseStack, IComponentModel compModel) {
     _serviceProvider = serviceProvider;
     _textView = textView;
     _intellisenseStack = intellisenseStack;
     _compModel = compModel;
     var agg = _compModel.GetService<IClassifierAggregatorService>();
     _incSearch = _compModel.GetService<IIncrementalSearchFactoryService>().GetIncrementalSearch(_textView);
     _editorOptions = editorOptions;
 }
            public CompletionClosedEventSource(
                IIntellisenseSessionStack sessionStack,
                TaggerDelay delay)
                : base(delay)
            {
                Contract.ThrowIfNull(sessionStack);

                _sessionStack = sessionStack;
            }
Пример #9
0
 internal WordCompletionSession(ITrackingSpan wordTrackingSpan, IIntellisenseSessionStack intellisenseSessionStack, ICompletionSession completionSession, CompletionSet wordCompletionSet)
 {
     _textView = completionSession.TextView;
     _wordTrackingSpan = wordTrackingSpan;
     _wordCompletionSet = wordCompletionSet;
     _completionSession = completionSession;
     _completionSession.Dismissed += delegate { OnDismissed(); };
     _intellisenseSessionStack = intellisenseSessionStack;
 }
Пример #10
0
 internal WordCompletionSession(ITrackingSpan wordTrackingSpan, IIntellisenseSessionStack intellisenseSessionStack, ICompletionSession completionSession, WordCompletionSet wordCompletionSet)
 {
     _textView                     = completionSession.TextView;
     _wordTrackingSpan             = wordTrackingSpan;
     _wordCompletionSet            = wordCompletionSet;
     _completionSession            = completionSession;
     _completionSession.Dismissed += delegate { OnDismissed(); };
     _intellisenseSessionStack     = intellisenseSessionStack;
 }
Пример #11
0
 internal WordLegacyCompletionSession(ITrackingSpan wordTrackingSpan, IIntellisenseSessionStack intellisenseSessionStack, ICompletionSession completionSession, WordLegacyCompletionSet wordCompletionSet)
 {
     _textView                     = completionSession.TextView;
     _wordTrackingSpan             = wordTrackingSpan;
     _wordCompletionSet            = wordCompletionSet;
     _completionSession            = completionSession;
     _initialText                  = _wordTrackingSpan.GetText(_textView.TextSnapshot);
     _completionSession.Dismissed += delegate { OnDismissed(); };
     _intellisenseSessionStack     = intellisenseSessionStack;
 }
Пример #12
0
        public KeyProcessor GetAssociatedProcessor(IWpfTextView textView)
        {
            if (textView == null)
            {
                throw new ArgumentNullException("textView");
            }
            IIntellisenseSessionStack stackForTextView = this.StackMapService.GetStackForTextView(textView);
            IEditorOperations         editorOperations = EditorOperationsFactoryService.GetEditorOperations(textView);

            return(new CALKeyProcessor(textView, editorOperations));
        }
            public CompletionClosedEventSource(
                ITextView textView,
                IIntellisenseSessionStack sessionStack,
                TaggerDelay delay)
                : base(delay)
            {
                Contract.ThrowIfNull(textView);
                Contract.ThrowIfNull(sessionStack);

                _textView = textView;
                _sessionStack = sessionStack;
            }
Пример #14
0
        public EditFilter(ITextView textView, IEditorOperations editorOps, IEditorOptions editorOptions, IIntellisenseSessionStack intellisenseStack, IComponentModel compModel)
        {
            _textView          = textView;
            _editorOps         = editorOps;
            _intellisenseStack = intellisenseStack;
            _compModel         = compModel;
            var agg = _compModel.GetService <IClassifierAggregatorService>();

            _classifier    = agg.GetClassifier(textView.TextBuffer);
            _incSearch     = _compModel.GetService <IIncrementalSearchFactoryService>().GetIncrementalSearch(_textView);
            _broker        = _compModel.GetService <ICompletionBroker>();
            _editorOptions = editorOptions;
        }
        internal CurrentLineSpaceReservationAgent(ITextView textView, IIntellisenseSessionStack sessionStack)
        {
            _textView     = textView;
            _sessionStack = sessionStack;

            // We'll need to know when the collection of sessions changes.
            ((INotifyCollectionChanged)_sessionStack.Sessions).CollectionChanged += this.OnIntellisenseSessions_CollectionChanged;

            // Make sure to unsubscribe when the view closes.
            EventHandler closedHandler = null;

            closedHandler = delegate
            {
                this.Detach();

                ((INotifyCollectionChanged)_sessionStack.Sessions).CollectionChanged -= this.OnIntellisenseSessions_CollectionChanged;
                _textView.Closed -= closedHandler;
            };
            _textView.Closed += closedHandler;
        }
Пример #16
0
        public ReadOnlyCollection <ISignatureHelpSession> GetSessions(ITextView textView)
        {
            FrugalList <ISignatureHelpSession> tempSessionList = new FrugalList <ISignatureHelpSession>();

            IIntellisenseSessionStack sessionStack = this.IntellisenseSessionStackMap.GetStackForTextView(textView);

            if (sessionStack == null)
            {
                return(tempSessionList.AsReadOnly());
            }

            foreach (var session in sessionStack.Sessions)
            {
                ISignatureHelpSession sigHelpSession = session as ISignatureHelpSession;
                if (sigHelpSession != null)
                {
                    tempSessionList.Add(sigHelpSession);
                }
            }

            return(tempSessionList.AsReadOnly());
        }
Пример #17
0
        public ISignatureHelpSession CreateSignatureHelpSession(ITextView textView, ITrackingPoint triggerPoint, bool trackCaret)
        {
            if (triggerPoint.TextBuffer != textView.TextBuffer)
            {
                // Map the trigger point up to the surface buffer.  That's where the session will live.
                SnapshotPoint?surfaceTriggerSnapPoint = textView.BufferGraph.MapUpToBuffer
                                                            (triggerPoint.GetPoint(triggerPoint.TextBuffer.CurrentSnapshot),
                                                            PointTrackingMode.Negative,
                                                            PositionAffinity.Successor,
                                                            textView.TextBuffer);
                if (!surfaceTriggerSnapPoint.HasValue)
                {
                    // We can't trigger a session when the trigger point doesn't map to the surface buffer.
                    return(null);
                }
                triggerPoint = surfaceTriggerSnapPoint.Value.Snapshot.CreateTrackingPoint
                                   (surfaceTriggerSnapPoint.Value.Position,
                                   PointTrackingMode.Negative);
            }

            // Make sure we can get ahold of a session stack.
            IIntellisenseSessionStack sessionStack = this.IntellisenseSessionStackMap.GetStackForTextView(textView);

            if (sessionStack == null)
            {
                throw new InvalidOperationException("Couldn't retrieve Intellisense Session Stack for the specified ITextView.");
            }

            SignatureHelpSession session = new SignatureHelpSession(this, textView, triggerPoint, trackCaret);

#if DEBUG
            Helpers.TrackObject(this.ObjectTrackers, "Signature Help Sessions", session);
#endif

            sessionStack.PushSession(session);
            return(session);
        }
Пример #18
0
		public PresenterMouseProcessor(IIntellisenseSessionStack intellisenseSessionStack) {
			if (intellisenseSessionStack == null)
				throw new ArgumentNullException(nameof(intellisenseSessionStack));
			this.intellisenseSessionStack = intellisenseSessionStack;
		}
Пример #19
0
 public PresenterMouseProcessor(IIntellisenseSessionStack intellisenseSessionStack) => this.intellisenseSessionStack = intellisenseSessionStack ?? throw new ArgumentNullException(nameof(intellisenseSessionStack));