Ejemplo n.º 1
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();
            }
        }
Ejemplo n.º 2
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();
            }
              }
        }
Ejemplo n.º 3
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();
                }
            }
        }
Ejemplo n.º 4
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();
                }
            }
        }
Ejemplo n.º 5
0
        /// <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)
        {
            string thisFile = VerilogLanguage.VerilogGlobals.GetDocumentPath(_textView.TextSnapshot);

            // VerilogLanguage.VerilogGlobals.ParseStatus_EnsureExists(thisFile);
            //if (VerilogLanguage.VerilogGlobals.NeedReparse)
            //if (VerilogLanguage.VerilogGlobals.ParseStatus[thisFile].NeedReparse)
            if (VerilogGlobals.ParseStatusController.NeedReparse(thisFile)) // ensure the dictionary item exists for the ParseStatus of this file and check if it is time to reparse
            {
                if (_subjectBuffers.Count == 1)
                {
                    VerilogLanguage.VerilogGlobals.Reparse(_subjectBuffers[0], thisFile);
                }
                else
                {
                    // how do we end up with multiple buffers?
                    // TODO - handle this?
                }
            }

            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>
        /// 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();
                }
            }
        }
Ejemplo n.º 7
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();
            }
        }
Ejemplo n.º 8
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();
                }
            }
        }