Example #1
0
        /// <summary>
        /// Updates the adornment with the variable information
        /// </summary>
        /// <param name="sender">event source</param>
        /// <param name="e">event arguments</param>
        public void UpdateAdornment(Object sender, MouseHoverEventArgs e)
        {
            if (debugger.CurrentMode != dbgDebugMode.dbgBreakMode || "TypeScript" != dte?.ActiveDocument?.Language)
            {
                return;
            }
            if (root.IsMouseOver)
            {
                return;
            }
            var variable = DebuggerVariable.FindUnderMousePointer(debugger, e);

            if (variable != null)
            {
                var position = GetVariablePosition(variable);
                if (position != null)
                {
                    MoveAdornment(position.Item1, position.Item2);

                    var newTreeView = TreeViewBuilder.GetTreeView(variable.Expression);
                    currentExpression = variable.Expression;
                    root.ResultTreeView.Items.Clear();
                    foreach (var item in newTreeView.Items)
                    {
                        root.ResultTreeView.Items.Add(item);
                    }
                }
            }
            else
            {
                MoveAdornment(9999, 9999);
            }
        }
Example #2
0
        private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            //find the mouse position by mapping down to the subject buffer
            SnapshotPoint?point = m_textView.BufferGraph
                                  .MapDownToFirstMatch(
                new SnapshotPoint(m_textView.TextSnapshot, e.Position),
                PointTrackingMode.Positive,
                snapshot => m_subjectBuffers.Contains(snapshot.TextBuffer),
                PositionAffinity.Predecessor);

            if (point == null)
            {
                return;
            }

            ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position,
                                                                                   PointTrackingMode.Positive);

            if (m_provider.QuickInfoBroker.IsQuickInfoActive(m_textView))
            {
                return;
            }

            m_provider.QuickInfoBroker.TriggerQuickInfo(m_textView, triggerPoint, true);
        }
Example #3
0
        private void OnTextViewMouseHover(object sender, MouseHoverEventArgs ee)
        {
            ITextBuffer buff = null;
            //find the mouse position by mapping down to the subject buffer
            SnapshotPoint?point = m_textView.BufferGraph.MapDownToFirstMatch
                                      (new SnapshotPoint(m_textView.TextSnapshot, ee.Position),
                                      PointTrackingMode.Positive,
                                      snapshot => m_subjectBuffers.Contains(buff = snapshot.TextBuffer),
                                      PositionAffinity.Predecessor);

            if (point != null)
            {
                ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position,
                                                                                       PointTrackingMode.Positive);

                EnvDTE.DTE      dte = SQVSUtils.GetService <EnvDTE.DTE>();
                EnvDTE.Debugger dbg = dte.Debugger as EnvDTE.Debugger;

                if (dbg != null && dte.Debugger.CurrentMode == dbgDebugMode.dbgBreakMode)
                {
                    string filename = SQLanguageServiceEX.GetFileName(buff);

                    SQProjectFileNode node = _languageService.GetNode(filename);
                    SQVSUtils.CreateDataTipViewFilter(_serviceProvider, node);
                }
                else if (!m_provider.QuickInfoBroker.IsQuickInfoActive(m_textView))
                {
                    //m_session = m_provider.QuickInfoBroker.TriggerQuickInfo(m_textView, triggerPoint, true);
                    /*Setting DEBUG_PROPERTY_INFO.bstrFullName enables the button. I think it uses that name to persist the data tip to a file. It sure would be nice if the documentation gets enhanced one of these days!*/
                }
            }
        }
Example #4
0
        private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            if (this.provider.QuickInfoBroker.IsQuickInfoActive(this.textView))
            {
                return;
            }
            var mousePoint = new SnapshotPoint(this.textView.TextSnapshot, e.Position);

            // If the mouse position maps to the csharp buffer then it should be handled by C# only.
            SnapshotPoint?csharpPoint = this.textView.BufferGraph.MapDownToBuffer(
                mousePoint, PointTrackingMode.Positive, this.csharpBuffer, PositionAffinity.Predecessor);

            if (csharpPoint != null)
            {
                return;
            }

            // Find the mouse position by mapping down to the subject (P#) buffer
            SnapshotPoint?point = this.textView.BufferGraph.MapDownToFirstMatch(
                mousePoint, PointTrackingMode.Positive, snapshot => this.subjectBuffers.Contains(snapshot.TextBuffer), PositionAffinity.Predecessor);

            if (point != null)
            {
                ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);
                this.session = this.provider.QuickInfoBroker.TriggerQuickInfo(this.textView, triggerPoint, true);
            }
        }
Example #5
0
        private void OnMouseHover(object sender, MouseHoverEventArgs e)
        {
            IntellisenseUtilities.ThrowIfNotOnMainThread(this.joinableTaskContext);

            SnapshotPoint?surfaceHoverPointNullable = e.TextPosition.GetPoint(
                this.textView.TextViewModel.DataBuffer,
                PositionAffinity.Predecessor);

            // Does hover correspond to actual position in document or
            // is there already a session around that is valid?
            if (!surfaceHoverPointNullable.HasValue || this.IsSessionStillValid(surfaceHoverPointNullable.Value))
            {
                return;
            }

            // Cancel last queued quick info update, if there is one.
            CancelAndDisposeToken();

            this.cancellationTokenSource = new CancellationTokenSource();

            // Start quick info session async on the UI thread.
            this.joinableTaskContext.Factory.RunAsync(async delegate
            {
                await UpdateSessionStateAsync(surfaceHoverPointNullable.Value, this.cancellationTokenSource.Token);

                // Clean up the cancellation token source.
                Debug.Assert(this.joinableTaskContext.IsOnMainThread);
                this.cancellationTokenSource.Dispose();
                this.cancellationTokenSource = null;
            });
        }
Example #6
0
        void TextView_MouseHover(object sender, MouseHoverEventArgs e)
        {
            SnapshotPoint?point = TextView.BufferGraph.MapDownToFirstMatch(
                new SnapshotPoint(TextView.TextSnapshot, e.Position),
                PointTrackingMode.Positive,
                snapshot => SubjectBuffers.Contains(snapshot.TextBuffer),
                PositionAffinity.Predecessor);

            if (point != null)
            {
                ITrackingPoint triggerPoint      = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);
                var            currentDispatcher = Dispatcher.CurrentDispatcher;
                if (!Provider.QuickInfoBroker.IsQuickInfoActive(TextView))
                {
                    JavaQuickInfo precomputedQuickInfo = new JavaQuickInfo(point.Value.Snapshot.TextBuffer);
                    precomputedQuickInfo.RequestQuickInfo(TextView, triggerPoint).ContinueWith((Task t) =>
                    {
                        currentDispatcher.Invoke(() =>
                        {
                            if (TextView != null) // Check whether detached
                            {
                                Thread.Sleep(100);
                                var newSession = Provider.QuickInfoBroker.CreateQuickInfoSession(TextView, triggerPoint, true);
                                if (newSession.Properties != null)
                                {
                                    newSession.Properties.AddProperty(typeof(JavaQuickInfo), precomputedQuickInfo);
                                    newSession.Start();
                                    Session = newSession;
                                }
                            }
                        });
                    });
                }
            }
        }
Example #7
0
 private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
 {
     try
     {
         string contentType = this.textView_.TextBuffer.ContentType.DisplayName;
         if (contentType.Equals(AsmDudePackage.DisassemblyContentType, StringComparison.Ordinal))
         {
             AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:OnTextViewMouseHover: Quickinfo for disassembly view. file={1}", this.ToString(), AsmDudeToolsStatic.GetFilename(this.textView_.TextBuffer)));
             SnapshotPoint?triggerPoint = this.GetMousePosition(new SnapshotPoint(this.textView_.TextSnapshot, e.Position));
             if (!triggerPoint.HasValue)
             {
                 AsmDudeToolsStatic.Output_WARNING(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:OnTextViewMouseHover: trigger point is null", this.ToString()));
             }
             else
             {
                 System.Drawing.Point p = System.Windows.Forms.Control.MousePosition;
                 this.ToolTipLegacy(triggerPoint.Value, new Point(p.X, p.Y));
             }
         }
         else
         {
             AsmDudeToolsStatic.Output_WARNING(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:OnTextViewMouseHover: does not have have AsmDudeContentType: but has type {1}", this.ToString(), contentType));
         }
     }
     catch (Exception e2)
     {
         AsmDudeToolsStatic.Output_WARNING(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:OnTextViewMouseHover: exception={1}", this.ToString(), e2.Message));
     }
 }
        private void OnMouseHover(object sender, MouseHoverEventArgs e)
        {
            if (m_view == null)
            {
                return;
            }
            if (!m_view.Properties.TryGetProperty(nameof(UIViewItem), out UIViewItem info))
            {
                return;
            }
            if (info == null)
            {
                return;
            }

            if (m_broker.IsQuickInfoActive(m_view))
            {
                return;
            }

            if (!m_view.TextBuffer.Properties.TryGetProperty(nameof(ALanguageQuickInfoSource), out ALanguageQuickInfoSource source))
            {
                return;
            }
            source.RefreshQuickInfo(0, 0, null);

            int offset = e.Position;

            if (m_view.Properties.TryGetProperty(nameof(ALanguageServer), out ALanguageServer server))
            {
                server.AddTask(() => server.QueryQuickInfo(info.GetFullPath(), offset));
            }
        }
Example #9
0
        Expression FindUnderMousePointer(EnvDTE.Debugger debugger, MouseHoverEventArgs e)
        {
            var point = e.TextPosition.GetPoint(e.TextPosition.AnchorBuffer, PositionAffinity.Predecessor);

            if (!point.HasValue)
            {
                return(null);
            }

            SnapshotSpan span;
            var          name = GetVariableNameAndSpan(point.Value, out span);

            if (name == null)
            {
                return(null);
            }

            var expression = debugger.GetExpression(name);

            if (!expression.IsValidValue)
            {
                return(null);
            }
            return(expression);
        }
        /// <summary>
        /// Determine if the mouse is hovering over a token. If so, highlight the token and display QuickInfo
        /// </summary>
        private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            //AsmDudeToolsStatic.Output("INFO: AsmQuickInfoController:OnTextViewMouseHover: file=" + AsmDudeToolsStatic.GetFileName(this._textView.TextBuffer));
            SnapshotPoint?point = GetMousePosition(new SnapshotPoint(this._textView.TextSnapshot, e.Position));

            if (point != null)
            {
                ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);
                // Find the broker for this buffer
                if (!this._quickInfoBroker.IsQuickInfoActive(this._textView))
                {
                    //AsmDudeToolsStatic.Output("INFO: AsmQuickInfoController:OnTextViewMouseHover: CreateQuickInfoSession for triggerPoint "+triggerPoint.TextBuffer+"; file=" + AsmDudeToolsStatic.GetFileName(this._textView.TextBuffer));
                    this._session = this._quickInfoBroker.CreateQuickInfoSession(this._textView, triggerPoint, false);
                    this._session.Start();
                }
                else
                {
                    //AsmDudeToolsStatic.Output("INFO: AsmQuickInfoController:OnTextViewMouseHover: quickInfoBroker is already active; file=" + AsmDudeToolsStatic.GetFileName(this._textView.TextBuffer));
                }
            }
            else
            {
                //AsmDudeToolsStatic.Output("INFO: AsmQuickInfoController:OnTextViewMouseHover: point is null; file=" + AsmDudeToolsStatic.GetFileName(this._textView.TextBuffer));
            }
        }
Example #11
0
        /// <summary>
        /// Activates a new QuickInfo session in response to the MouseHover event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void textView_MouseHover(object sender, MouseHoverEventArgs e)
        {
            if (activeSession != null)
            {
                activeSession.Dismiss();
            }

            SnapshotPoint?point = e.TextPosition.GetPoint(
                textBuffer =>
                (
                    buffer == textBuffer
                    // only text buffers require expilicit session activation
                    // XML and HTML already have quickInfo session activation code
                    // adding our own would cause 'double vision' - our source would be hit
                    // by our session as well as by the standard one
                    && textBuffer.ContentType.TypeName == "plaintext"
                )
                , PositionAffinity.Predecessor);

            if (point.HasValue)
            {
                ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);

                activeSession = provider.quickInfoBroker.CreateQuickInfoSession(textView, triggerPoint, true);
                activeSession.Start();
            }
        }
Example #12
0
            private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
            {
                if (XSharpProjectPackage.Instance.DebuggerIsRunning)
                {
                    return;
                }
                try
                {
                    //find the mouse position by mapping down to the subject buffer
                    SnapshotPoint?point = m_textView.BufferGraph.MapDownToFirstMatch
                                              (new SnapshotPoint(m_textView.TextSnapshot, e.Position),
                                              PointTrackingMode.Positive,
                                              snapshot => m_subjectBuffers.Contains(snapshot.TextBuffer),
                                              PositionAffinity.Predecessor);

                    if (point.HasValue && point.Value.Position != lastPointPosition)
                    {
                        lastPointPosition = point.Value.Position;
                        if (!m_provider.QuickInfoBroker.IsQuickInfoActive(m_textView))
                        {
                            ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position,
                                                                                                   PointTrackingMode.Positive);
                            m_session = m_provider.QuickInfoBroker.TriggerQuickInfo(m_textView, triggerPoint, true);
                        }
                    }
                }
                catch (Exception ex)
                {
                    XSharpProjectPackage.Instance.DisplayOutPutMessage("XSharpQuickInfo.OnTextViewMouseHover failed");
                    XSharpProjectPackage.Instance.DisplayException(ex);
                }
            }
Example #13
0
        void _view_MouseHover(object sender, MouseHoverEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(
                KeywordDetect.DetectKeyword(e.TextPosition.AnchorBuffer.CurrentSnapshot.GetText(),
                                            e.Position));

            System.Diagnostics.Debug.WriteLine("GetWordExtent: " + GetExpression(e));
        }
Example #14
0
        private void TextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            if (_quickInfoSession != null && !_quickInfoSession.IsDismissed) {
                _quickInfoSession.Dismiss();
            }

            _quickInfoSession = _provider._QuickInfoBroker.TriggerQuickInfo(_textView, _textView.TextSnapshot.CreateTrackingPoint(e.Position, PointTrackingMode.Negative), true);
        }
Example #15
0
        protected virtual void OnFigureMouseHover(MouseHoverEventArgs e)
        {
            var handler = MouseHover;

            if (handler != null)
            {
                handler(this, e);
            }
        }
        private void TextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            if (_quickInfoSession != null && !_quickInfoSession.IsDismissed)
            {
                _quickInfoSession.Dismiss();
            }

            _quickInfoSession = _provider._QuickInfoBroker.TriggerQuickInfo(_textView, _textView.TextSnapshot.CreateTrackingPoint(e.Position, PointTrackingMode.Negative), true);
        }
Example #17
0
        public void HoverMouse(MouseHoverEventArgs args)
        {
            var mouseHover = MouseHover;

            if (mouseHover != null)
            {
                mouseHover(this, args);
            }
        }
Example #18
0
        void _textView_MouseHover(object sender, MouseHoverEventArgs e)
        {
            var point = new SnapshotPoint(e.View.TextSnapshot, e.Position);
            //var span = e.View.GetTextElementSpan(point);
            var span = point.GetContainingLine().Extent;

            if (TagsChanged != null)
            {
                TagsChanged(this, new SnapshotSpanEventArgs(span));
            }
        }
Example #19
0
 void textView_MouseHover(object sender, MouseHoverEventArgs e)
 {
     if (InspectMode.IsInspectModeEnabled)
     {
         var doc = WebEssentialsPackage.DTE.ActiveDocument;
         if (doc != null)
         {
             InspectMode.Select(e.View.TextDataModel.DocumentBuffer.GetFileName(), e.Position);
         }
     }
 }
 void textView_MouseHover(object sender, MouseHoverEventArgs e)
 {
     if (InspectMode.IsInspectModeEnabled)
     {
         var doc = EditorExtensionsPackage.DTE.ActiveDocument;
         if (doc != null)
         {
             InspectMode.Select(e.View.TextDataModel.DocumentBuffer.GetFileName(), e.Position);
         }
     }
 }
        // internal for exposure to unit tests
        internal void RaiseHoverEvents()
        {
            MonoDevelop.Core.Runtime.AssertMainThread();

            //See if there are any unfired events that are ready to fire.
            MouseHoverEventData         nextEvent    = null;
            IList <MouseHoverEventData> eventsToFire = new List <MouseHoverEventData> ();

            lock (_mouseHoverEvents) {
                foreach (var eventData in _mouseHoverEvents)
                {
                    if (!eventData.Fired)
                    {
                        if (eventData.Attribute.Delay <= _millisecondsSinceMouseMove)
                        {
                            eventsToFire.Add(eventData);
                        }
                        else if ((nextEvent == null) || (eventData.Attribute.Delay < nextEvent.Attribute.Delay))
                        {
                            nextEvent = eventData;
                        }
                    }
                }
            }

            if (eventsToFire.Count > 0)
            {
                MouseHoverEventArgs args = new MouseHoverEventArgs(this, _lastHoverPosition.Value,
                                                                   bufferGraph.CreateMappingPoint(new SnapshotPoint(Document.TextBuffer.CurrentSnapshot, _lastHoverPosition.Value), PointTrackingMode.Positive));
                foreach (var eventData in eventsToFire)
                {
                    eventData.Fired = true;

                    try {
                        eventData.EventHandler(this, args);
                    } catch (Exception e) {
                        factoryService.GuardedOperations.HandleException(eventData.EventHandler, e);
                    }
                }
            }

            if (nextEvent == null)
            {
                //No more events to fire ... stop the timer.
                _mouseHoverTimer.Stop();
            }
            else
            {
                //Set the timer interval to match the delay to the next event.
                int newDelay = Math.Max(50, (nextEvent.Attribute.Delay - _millisecondsSinceMouseMove));
                _mouseHoverTimer.Interval = newDelay;
            }
        }
 private void TextViewMouseHover(object sender, MouseHoverEventArgs e) {
     if (_quickInfoSession != null && !_quickInfoSession.IsDismissed) {
         _quickInfoSession.Dismiss();
     }
     var pt = e.TextPosition.GetPoint(IsNodejsContent, PositionAffinity.Successor);
     if (pt != null) {
         _quickInfoSession = _provider._QuickInfoBroker.TriggerQuickInfo(
             _textView,
             pt.Value.Snapshot.CreateTrackingPoint(pt.Value.Position, PointTrackingMode.Positive),
             true);
     }
 }
Example #23
0
        void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            SnapshotPoint? point = GetMousePosition(new SnapshotPoint(_textView.TextSnapshot, e.Position));

              if (point != null) {
            ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);

            // Find the broker for this buffer
            if (!_componentContext.QuickInfoBroker.IsQuickInfoActive(_textView)) {
              _session = _componentContext.QuickInfoBroker.CreateQuickInfoSession(_textView, triggerPoint, true);
              _session.Start();
            }
              }
        }
        /// <summary>
        /// Determine if the mouse is hovering over a token. If so, highlight the token and display QuickInfo
        /// </summary>
        private async void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            SnapshotPoint?point = GetMousePosition(new SnapshotPoint(_textView.TextSnapshot, e.Position));

            if (point.HasValue)
            {
                ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);

                // Find the broker for this buffer
                if (!_componentContext.QuickInfoBroker.IsQuickInfoActive(_textView))
                {
                    _session = await _componentContext.QuickInfoBroker.TriggerQuickInfoAsync(_textView, triggerPoint);
                }
            }
        }
        void TextView_MouseHover(object sender, MouseHoverEventArgs e)
        {
            var spanData = GetReference(e.Position);

            if (spanData != null && currentReference != null && SameReferences(currentReference.Value, spanData.Value))
            {
                return;
            }

            CloseToolTip();
            if (spanData != null)
            {
                ShowToolTip(spanData.Value);
            }
        }
Example #26
0
        private void TextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            if (_quickInfoSession != null && !_quickInfoSession.IsDismissed)
            {
                _quickInfoSession.Dismiss();
            }
            var pt = e.TextPosition.GetPoint(EditorExtensions.IsPythonContent, PositionAffinity.Successor);

            if (pt != null)
            {
                _quickInfoSession = _provider._QuickInfoBroker.TriggerQuickInfo(
                    _textView,
                    pt.Value.Snapshot.CreateTrackingPoint(pt.Value.Position, PointTrackingMode.Positive),
                    true);
            }
        }
Example #27
0
        void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            SnapshotPoint?point = GetMousePosition(new SnapshotPoint(_textView.TextSnapshot, e.Position));

            if (point != null)
            {
                ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);

                // Find the broker for this buffer
                if (!_componentContext.QuickInfoBroker.IsQuickInfoActive(_textView))
                {
                    _session = _componentContext.QuickInfoBroker.CreateQuickInfoSession(_textView, triggerPoint, true);
                    _session.Start();
                }
            }
        }
Example #28
0
        void OnViewMouseHover(object sender, MouseHoverEventArgs e) {
            //find the mouse position by mapping down to the subject buffer
            SnapshotPoint? point = _textView.BufferGraph.MapDownToFirstMatch
                 (new SnapshotPoint(_textView.TextSnapshot, e.Position),
                PointTrackingMode.Positive,
                snapshot => _subjectBuffers.Contains(snapshot.TextBuffer),
                PositionAffinity.Predecessor);

            if (point != null) {
                ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position,
                PointTrackingMode.Positive);

                if (!_quickInfoBroker.IsQuickInfoActive(_textView))
                    _quickInfoBroker.TriggerQuickInfo(_textView, triggerPoint, true);
            }
        }
        private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            var point = view.BufferGraph.MapDownToFirstMatch(new SnapshotPoint(view.TextSnapshot, e.Position), PointTrackingMode.Positive,
                                                             snapshot => buffers.Contains(snapshot.TextBuffer), PositionAffinity.Predecessor);

            if (point == null)
            {
                return;
            }

            if (!provider.QuickInfoBroker.IsQuickInfoActive(view))
            {
                var triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);
                provider.QuickInfoBroker.TriggerQuickInfo(view, triggerPoint, true);
            }
        }
Example #30
0
 void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
 {
     SnapshotPoint? point = textView.BufferGraph.MapDownToFirstMatch(
     new SnapshotPoint(textView.TextSnapshot, e.Position),
     PointTrackingMode.Positive,
     snapshot => textBuffers.Contains(snapshot.TextBuffer),
     PositionAffinity.Predecessor
       );
       if ( point != null ) {
     ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(
       point.Value.Position, PointTrackingMode.Positive);
     if ( provider.QuickInfoBroker.IsQuickInfoActive(textView) ) {
       session = provider.QuickInfoBroker.TriggerQuickInfo(textView, triggerPoint, true);
     }
       }
 }
        protected virtual void OnMouseHover(MouseHoverEventArgs e)
        {
            var handler = MouseHover;

            if (handler != null)
            {
                handler(this, e);
            }

            if (_mouseEventsToForwards != null)
            {
                foreach (var forward in _MouseEventsToForwards)
                {
                    forward.HandleMouseHover(e);
                }
            }
        }
Example #32
0
        /// <summary>
        /// Add the mouse hover event handler that triggers the QuickInfo session.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The <see cref="MouseHoverEventArgs"/>.
        /// </param>
        private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            // find the mouse position by mapping down to the subject buffer
            var point = GetMousePosition(new SnapshotPoint(textView.TextSnapshot, e.Position));

            if (point != null)
            {
                var triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);

                // Find the broker for this buffer
                if (!componentContext.QuickInfoBroker.IsQuickInfoActive(textView))
                {
                    session = componentContext.QuickInfoBroker.CreateQuickInfoSession(textView, triggerPoint, true);
                    session.Start();
                }
            }
        }
        private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            // I don't really know what this is all for; but it's in the MSDN sample...
            // http://msdn.microsoft.com/en-us/library/vstudio/ee197646(v=vs.120).aspx
            SnapshotPoint?point = textView.BufferGraph.MapDownToFirstMatch(new SnapshotPoint(textView.TextSnapshot, e.Position), PointTrackingMode.Positive, snapshot => subjectBuffers.Contains(snapshot.TextBuffer), PositionAffinity.Predecessor);

            if (point != null)
            {
                ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position,
                                                                                       PointTrackingMode.Positive);

                if (!provider.QuickInfoBroker.IsQuickInfoActive(textView))
                {
                    session = provider.QuickInfoBroker.TriggerQuickInfo(textView, triggerPoint, true);
                }
            }
        }
        private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            // I don't really know what this is all for; but it's in the MSDN sample...
            // http://msdn.microsoft.com/en-us/library/vstudio/ee197646(v=vs.120).aspx
            SnapshotPoint? point = textView.BufferGraph.MapDownToFirstMatch(new SnapshotPoint(textView.TextSnapshot, e.Position), PointTrackingMode.Positive, snapshot => subjectBuffers.Contains(snapshot.TextBuffer), PositionAffinity.Predecessor);

            if (point != null)
            {
                ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position,
                PointTrackingMode.Positive);

                if (!provider.QuickInfoBroker.IsQuickInfoActive(textView))
                {
                    session = provider.QuickInfoBroker.TriggerQuickInfo(textView, triggerPoint, true);
                }
            }
        }
Example #35
0
        void textView_MouseHover(object sender, MouseHoverEventArgs e)
        {
            SnapshotPoint?ssPoint = textView.BufferGraph.MapDownToFirstMatch(new SnapshotPoint(textView.TextSnapshot, e.Position),
                                                                             PointTrackingMode.Positive,
                                                                             snapshot => textBuffers.Contains(snapshot.TextBuffer),
                                                                             PositionAffinity.Predecessor);

            if (ssPoint != null)
            {
                ITrackingPoint point = ssPoint.Value.Snapshot.CreateTrackingPoint(ssPoint.Value.Position, PointTrackingMode.Positive);

                if (!controllerProvider.QuickInfoBroker.IsQuickInfoActive(this.textView))
                {
                    quickInfoSession = controllerProvider.QuickInfoBroker.TriggerQuickInfo(textView, point, true);
                }
            }
        }
Example #36
0
        private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            SnapshotPoint?point = _textView.BufferGraph.MapDownToFirstMatch
                                      (new SnapshotPoint(_textView.TextSnapshot, e.Position),
                                      PointTrackingMode.Positive,
                                      snapshot => _subjectBuffers.Contains(snapshot.TextBuffer),
                                      PositionAffinity.Predecessor);

            if (point != null)
            {
                ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);

                if (!_provider.QuickInfoBroker.IsQuickInfoActive(_textView))
                {
                    _session = _provider.QuickInfoBroker.TriggerQuickInfo(_textView, triggerPoint, true);
                }
            }
        }
Example #37
0
        private void OnViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            //find the mouse position by mapping down to the subject buffer
            var point = _textView.BufferGraph.MapDownToFirstMatch
                            (new SnapshotPoint(_textView.TextSnapshot, e.Position),
                            PointTrackingMode.Positive,
                            snapshot => _subjectBuffers.Contains(snapshot.TextBuffer),
                            PositionAffinity.Predecessor);

            if (point != null)
            {
                var triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);
                if (!_quickInfoBroker.IsQuickInfoActive(_textView) && !_signatureHelpBroker.IsSignatureHelpActive(_textView))
                {
                    _quickInfoBroker.TriggerQuickInfo(_textView, triggerPoint, true);
                }
            }
        }
Example #38
0
        Expression FindUnderMousePointer(EnvDTE.Debugger debugger, MouseHoverEventArgs e)
        {
            var point = e.TextPosition.GetPoint(e.TextPosition.AnchorBuffer, PositionAffinity.Predecessor);
            if (!point.HasValue)
            {
                return null;
            }

            SnapshotSpan span;
            var name = GetVariableNameAndSpan(point.Value, out span);
            if (name == null)
            {
                return null;
            }

            var expression = debugger.GetExpression(name);
            if (!expression.IsValidValue)
            {
                return null;
            }
            return expression;
        }
Example #39
0
		void TextView_MouseHover(object sender, MouseHoverEventArgs e) {
			var pos = e.TextPosition.GetPoint(textView.TextBuffer, PositionAffinity.Successor);
			if (pos == null)
				return;
			var sessions = quickInfoBroker.GetSessions(textView);
			foreach (var session in sessions) {
				if (Intersects(session.ApplicableToSpan, pos.Value))
					return;
				if ((session as IQuickInfoSession2)?.HasInteractiveContent == true) {
					foreach (var o in session.QuickInfoContent) {
						var io = o as IInteractiveQuickInfoContent;
						if (io == null)
							continue;
						if (io.KeepQuickInfoOpen || io.IsMouseOverAggregated)
							return;
					}
				}
			}
			foreach (var session in sessions)
				session.Dismiss();
			var triggerPoint = pos.Value.Snapshot.CreateTrackingPoint(pos.Value.Position, PointTrackingMode.Negative);
			quickInfoBroker.TriggerQuickInfo(textView, triggerPoint, trackMouse: true);
		}
 /// <summary>
 /// Show the relevant colour swatch for the position of the mouse
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void OnMouseHover(object sender, MouseHoverEventArgs args)
 {
     ShowColourSwatch(args.Position, args.TextPosition, args.View);
 }
Example #41
0
        /// <summary>
        /// Activates a new QuickInfo session in response to the MouseHover event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void textView_MouseHover(object sender, MouseHoverEventArgs e)
        {
            if (activeSession != null)
                activeSession.Dismiss();

            SnapshotPoint? point = e.TextPosition.GetPoint(
                textBuffer =>
                    (
                        buffer == textBuffer
                                // only text buffers require expilicit session activation
                                // XML and HTML already have quickInfo session activation code
                                // adding our own would cause 'double vision' - our source would be hit
                                // by our session as well as by the standard one
                        && textBuffer.ContentType.TypeName == "plaintext"
                    )
                ,PositionAffinity.Predecessor);

            if (point.HasValue)
            {
                ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);

                activeSession = provider.quickInfoBroker.CreateQuickInfoSession(textView, triggerPoint, true);
                activeSession.Start();
            }
        }
        private void OnViewMouseHover(object sender, MouseHoverEventArgs e)
        {

        }
Example #43
0
        private async void TextViewMouseHover(object sender, MouseHoverEventArgs e) {
            if (_quickInfoSession != null && !_quickInfoSession.IsDismissed) {
                _quickInfoSession.Dismiss();
            }

            var pt = e.TextPosition.GetPoint(EditorExtensions.IsPythonContent, PositionAffinity.Successor);
            if (pt != null) {
                if (_textView.TextBuffer.GetInteractiveWindow() != null &&
                    pt.Value.Snapshot.Length > 1 &&
                    pt.Value.Snapshot[0] == '$') {
                    // don't provide quick info on help, the content type doesn't switch until we have
                    // a complete command otherwise we shouldn't need to do this.
                    return;
                }

                var quickInfo = await VsProjectAnalyzer.GetQuickInfoAsync(
                    _serviceProvider,
                    _textView,
                    pt.Value,
                    TimeSpan.FromSeconds(1.0)
                );

                QuickInfoSource.AddQuickInfo(_textView, quickInfo);

                var viewPoint = _textView.BufferGraph.MapUpToBuffer(
                    pt.Value,
                    PointTrackingMode.Positive,
                    PositionAffinity.Successor,
                    _textView.TextBuffer
                );

                if (viewPoint != null) {
                    _quickInfoSession = _provider._QuickInfoBroker.TriggerQuickInfo(
                        _textView,
                        viewPoint.Value.Snapshot.CreateTrackingPoint(viewPoint.Value, PointTrackingMode.Positive),
                        true
                    );
                }
            }
        }
Example #44
0
        void TextView_MouseHover(object sender, MouseHoverEventArgs e)
        {
            SnapshotPoint? point = TextView.BufferGraph.MapDownToFirstMatch(
                new SnapshotPoint(TextView.TextSnapshot, e.Position),
                PointTrackingMode.Positive,
                snapshot => SubjectBuffers.Contains(snapshot.TextBuffer),
                PositionAffinity.Predecessor);

            if (point != null)
            {
                ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);
                var currentDispatcher = Dispatcher.CurrentDispatcher;
                if (!Provider.QuickInfoBroker.IsQuickInfoActive(TextView))
                {
                    JavaQuickInfo precomputedQuickInfo = new JavaQuickInfo(point.Value.Snapshot.TextBuffer);
                    precomputedQuickInfo.RequestQuickInfo(TextView, triggerPoint).ContinueWith((Task t) =>
                    {
                        currentDispatcher.Invoke(() =>
                        {
                            if (TextView != null) // Check whether detached
                            {
                                Thread.Sleep(100);
                                var newSession = Provider.QuickInfoBroker.CreateQuickInfoSession(TextView, triggerPoint, true);
                                if (newSession.Properties != null)
                                {
                                    newSession.Properties.AddProperty(typeof(JavaQuickInfo), precomputedQuickInfo);
                                    newSession.Start();
                                    Session = newSession;
                                }
                            }
                        });
                    });
                }
            }
        }
Example #45
0
 public void HoverMouse(MouseHoverEventArgs args) {
     var mouseHover = MouseHover;
     if (mouseHover != null) {
         mouseHover(this, args);
     }
 }
        private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            var point = view.BufferGraph.MapDownToFirstMatch(new SnapshotPoint(view.TextSnapshot, e.Position), PointTrackingMode.Positive,
                snapshot => buffers.Contains(snapshot.TextBuffer), PositionAffinity.Predecessor);

            if (point == null) return;

            if (!provider.QuickInfoBroker.IsQuickInfoActive(view))
            {
                var triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);
                provider.QuickInfoBroker.TriggerQuickInfo(view, triggerPoint, true);
            }
        }
Example #47
0
 private void WpfTextViewOnMouseHover(object sender, MouseHoverEventArgs e)
 {
     _quickInfoManager.TriggerQuickInfo(e.Position);
 }
Example #48
0
        /// <summary>
        /// Activates a new QuickInfo session in response to the MouseHover event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void textView_MouseHover(object sender, MouseHoverEventArgs e)
        {
            if (activeSession != null)
                activeSession.Dismiss();

            SnapshotPoint? point = e.TextPosition.GetPoint(
                textBuffer =>
                    (
                        subjectBuffers.Contains(textBuffer)
                        && nodeProviderBroker.IsNDjango(textBuffer, context)
                        && brokerMapService.GetBrokerForTextView(textView, textBuffer) != null
                        && !(textBuffer is IProjectionBuffer)
                    )
                ,PositionAffinity.Predecessor);

            if (point.HasValue)
            {
                NodeProvider nodeProvider = nodeProviderBroker.GetNodeProvider(point.Value.Snapshot.TextBuffer);
                List<INode> quickInfoNodes = nodeProvider.GetNodes(point.Value);
                if (quickInfoNodes != null)
                {
                    // the invocation occurred in a subject buffer of interest to us
                    IQuickInfoBroker broker = brokerMapService.GetBrokerForTextView(textView, point.Value.Snapshot.TextBuffer);
                    ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);

                    activeSession = broker.CreateQuickInfoSession(triggerPoint, true);
                    activeSession.Properties.AddProperty(typeof(SourceProvider), quickInfoNodes);
                    activeSession.Start();
                }
            }
        }
			void Timer_Tick(object sender, EventArgs e) {
				if (owner.IsClosed || !owner.IsVisible || position == null || position.Value > owner.TextSnapshot.Length) {
					ClearMouseHoverPositionAndStopTimer();
					return;
				}
				Debug.Assert(timerStart != null);
				var list = GetHandlersToNotify();
				if (list != null) {
					var mhe = new MouseHoverEventArgs(owner, position.Value, owner.BufferGraph.CreateMappingPoint(new SnapshotPoint(owner.TextSnapshot, position.Value), PointTrackingMode.Positive));
					foreach (var h in list) {
						h.Raised = true;
						h.Handler(owner, mhe);
					}
				}
				UpdateTimer();
			}
        /// <summary>
        /// Add the mouse hover event handler that triggers the QuickInfo session.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The <see cref="MouseHoverEventArgs"/>.
        /// </param>
        private void OnTextViewMouseHover(object sender, MouseHoverEventArgs e)
        {
            // find the mouse position by mapping down to the subject buffer
            var point = GetMousePosition(new SnapshotPoint(textView.TextSnapshot, e.Position));

            if (point != null)
            {
                var triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive);

                // Find the broker for this buffer
                if (!componentContext.QuickInfoBroker.IsQuickInfoActive(textView))
                {
                    session = componentContext.QuickInfoBroker.CreateQuickInfoSession(textView, triggerPoint, true);
                    session.Start();
                }
            }
        }
Example #51
0
        private void OnMouseHover(object sender, MouseHoverEventArgs e)
        {
            if (m_debugger.CurrentMode != dbgDebugMode.dbgBreakMode)
            {
                return;
            }
            if (VSGraphVizPackage.expressionGraph == null)
                return;

            var exp = FindUnderMousePointer(m_debugger, e);
            if (exp == null)
                return;
            if (!exp.IsValidValue)
                return;
            VSGraphVizPackage.expressionGraph.SetExpression(exp);
        }