当前位置: 首页>>代码示例>>C#>>正文


C# IQuickInfoSession.GetTriggerPoint方法代码示例

本文整理汇总了C#中IQuickInfoSession.GetTriggerPoint方法的典型用法代码示例。如果您正苦于以下问题:C# IQuickInfoSession.GetTriggerPoint方法的具体用法?C# IQuickInfoSession.GetTriggerPoint怎么用?C# IQuickInfoSession.GetTriggerPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IQuickInfoSession的用法示例。


在下文中一共展示了IQuickInfoSession.GetTriggerPoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AugmentQuickInfoSession

        public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = null;

            if (!EnsureTreeInitialized() || session == null || qiContent == null)
                return;

            SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
            if (!point.HasValue)
                return;

            ParseItem item = _tree.StyleSheet.ItemBeforePosition(point.Value.Position);
            if (item == null || !item.IsValid)
                return;

            UrlItem urlItem = item.FindType<UrlItem>();

            if (urlItem != null && urlItem.UrlString != null && urlItem.UrlString.IsValid)
            {
                string url = GetFileName(urlItem.UrlString.Text.Trim('\'', '"'));
                if (!string.IsNullOrEmpty(url))
                {
                    applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(point.Value.Position, 1, SpanTrackingMode.EdgeNegative);
                    var image = CreateImage(url);
                    if (image != null && image.Source != null)
                    {
                        qiContent.Add(image);
                        qiContent.Add(Math.Round(image.Source.Width) + "x" + Math.Round(image.Source.Height));
                    }
                }
            }
        }
开发者ID:LogoPhonix,项目名称:WebEssentials2012,代码行数:32,代码来源:ImageQuickInfo.cs

示例2: AugmentQuickInfoSession

        public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan) {
            applicableToSpan = null;

            var semanticModelResult = SemanticModelService.SemanticModelResult;
            if (semanticModelResult == null) {
               return;
            }

            // Map the trigger point down to our buffer.
            SnapshotPoint? subjectTriggerPoint = session.GetTriggerPoint(semanticModelResult.Snapshot);
            if (!subjectTriggerPoint.HasValue) {
                return;
            }
           
            var triggerSymbol = semanticModelResult.CompilationUnit.Symbols.FindAtPosition(subjectTriggerPoint.Value.Position);

            if (triggerSymbol == null) {
                return;
            }

            foreach(var content in SymbolQuickInfoBuilder.Build(triggerSymbol, SyntaxQuickinfoBuilderService)) {                 
                qiContent.Add(content);
            }
            
            var location = triggerSymbol.Location;
            applicableToSpan = semanticModelResult.Snapshot.CreateTrackingSpan(
                    location.Start,
                    location.Length,
                    SpanTrackingMode.EdgeExclusive);
        }
开发者ID:csharper2010,项目名称:Nav.Language.Extensions,代码行数:30,代码来源:SymbolQuickInfoSource.cs

示例3: AugmentQuickInfoSession

        /// <summary>
        /// Determine which pieces of Quickinfo content should be displayed
        /// </summary>
        public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = null;

            if (_disposed)
                throw new ObjectDisposedException("TestQuickInfoSource");

            var triggerPoint = (SnapshotPoint) session.GetTriggerPoint(_buffer.CurrentSnapshot);

            if (triggerPoint == null)
                return;

            foreach (IMappingTagSpan<LuaTokenTag> curTag in _aggregator.GetTags(new SnapshotSpan(triggerPoint, triggerPoint)))
            {
                if (curTag.Tag.type == LuaTokenTypes.ReservedWord)
                {
                    var tagSpan = curTag.Span.GetSpans(_buffer).First();
                    applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(tagSpan, SpanTrackingMode.EdgeExclusive);
                    quickInfoContent.Add("A reserved word");
                }
                else if (curTag.Tag.type == LuaTokenTypes.Operators)
                {
                    var tagSpan = curTag.Span.GetSpans(_buffer).First();
                    applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(tagSpan, SpanTrackingMode.EdgeExclusive);
                    quickInfoContent.Add("A language operator");
                }
            }
        }
开发者ID:Luk3M,项目名称:CharmLua,代码行数:31,代码来源:LuaQuickInfoSource.cs

示例4: AugmentQuickInfoSession

        public void AugmentQuickInfoSession(
        IQuickInfoSession session, IList<object> quickInfoContent,
        out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = null;
              SnapshotPoint? subjectTriggerPoint =
            session.GetTriggerPoint(textBuffer.CurrentSnapshot);
              if ( !subjectTriggerPoint.HasValue ) {
            return;
              }
              ITextSnapshot currentSnapshot = subjectTriggerPoint.Value.Snapshot;
              SnapshotSpan querySpan = new SnapshotSpan(subjectTriggerPoint.Value, 0);

              var tagAggregator = GetAggregator(session);
              TextExtent extent = FindExtentAtPoint(subjectTriggerPoint);

              if ( CheckForPrefixTag(tagAggregator, extent.Span) ) {
            string text = extent.Span.GetText();
            string url = FindNSUri(extent.Span, GetDocText(extent.Span));
            applicableToSpan = currentSnapshot.CreateTrackingSpan(
              extent.Span, SpanTrackingMode.EdgeInclusive
            );
            String toolTipText = String.Format("Prefix: {0}\r\nNamespace: {1}", text, url);
            quickInfoContent.Add(toolTipText);
              }
        }
开发者ID:tomasr,项目名称:BetterXml,代码行数:26,代码来源:QuickInfo.cs

示例5: AugmentQuickInfoSession

        public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = null;

            if (session == null || qiContent == null)
                return;

            // Map the trigger point down to our buffer.
            SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
            if (!point.HasValue)
                return;

            var snapshot = _buffer.CurrentSnapshot;
            var classifier = _classifierService.GetClassifier(_buffer);

            var doc = new SnapshotSpan(snapshot, 0, snapshot.Length);
            var line = point.Value.GetContainingLine();
            var idents = classifier.GetClassificationSpans(line.Extent);

            bool handled = HandleVariables(qiContent, ref applicableToSpan, idents, point);

            if (handled)
                return;

            HandleKeywords(qiContent, ref applicableToSpan, idents, point);
        }
开发者ID:yannduran,项目名称:OpenCommandLine,代码行数:26,代码来源:CmdQuickInfo.cs

示例6: AugmentQuickInfoSession

        /// <summary>
        /// Determine which pieces of Quickinfo content should be displayed
        /// </summary>
        public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = null;

            if (_disposed)
                throw new ObjectDisposedException("TestQuickInfoSource");

            var triggerPoint = (SnapshotPoint) session.GetTriggerPoint(_buffer.CurrentSnapshot);

            if (triggerPoint == null)
                return;

            foreach (IMappingTagSpan<OokTokenTag> curTag in _aggregator.GetTags(new SnapshotSpan(triggerPoint, triggerPoint)))
            {
                if (curTag.Tag.type == OokTokenTypes.OokExclamation)
                {
                    var tagSpan = curTag.Span.GetSpans(_buffer).First();
                    applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(tagSpan, SpanTrackingMode.EdgeExclusive);
                    quickInfoContent.Add("Exclaimed Ook!");
                }
                else if (curTag.Tag.type == OokTokenTypes.OokQuestion)
                {
                    var tagSpan = curTag.Span.GetSpans(_buffer).First();
                    applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(tagSpan, SpanTrackingMode.EdgeExclusive);
                    quickInfoContent.Add("Question Ook?");
                }
                else if (curTag.Tag.type == OokTokenTypes.OokPeriod)
                {
                    var tagSpan = curTag.Span.GetSpans(_buffer).First();
                    applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(tagSpan, SpanTrackingMode.EdgeExclusive);
                    quickInfoContent.Add("Regular Ook.");
                }
            }
        }
开发者ID:luyikk,项目名称:NLUATool,代码行数:37,代码来源:OokQuickInfoSource.cs

示例7: AugmentQuickInfoSession

		public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
		{
			applicableToSpan = null;

			var triggerPoint = session.GetTriggerPoint(buffer.CurrentSnapshot);
			if (triggerPoint == null)
				return;

			ITextDocument doc;
			if (!provider.TextDocumentFactoryService.TryGetTextDocument(buffer, out doc))
				return;

			IOutputWindowPane diagnostics = provider.OutputWindowService.TryGetPane(OutputWindowPanes.DartVSDiagnostics);
			if (diagnostics != null)
				diagnostics.WriteLine("Quick info requested for: " + doc.FilePath);

			// Figure out if this is a recalculate for an existing span (not sure if this is the best way of supporting async...?)
			if (inProgressPosition != null && inProgressPosition.Value == triggerPoint.Value.Position)
			{
				UpdateTooltip(session, quickInfoContent, out applicableToSpan);
			}
			else
			{
				applicableToSpan = GetApplicableToSpan(triggerPoint);
				var ignoredTask = StartTooltipRequestAsync(session, quickInfoContent, applicableToSpan, triggerPoint, doc.FilePath);
			}
		}
开发者ID:modulexcite,项目名称:DartVS,代码行数:27,代码来源:QuickInfoSourceProvider.cs

示例8: AugmentQuickInfoSession

        public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = null;

            if (!EnsureTreeInitialized() || session == null || qiContent == null)
                return;

            // Map the trigger point down to our buffer.
            SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
            if (!point.HasValue)
                return;

            ParseItem item = _tree.StyleSheet.ItemBeforePosition(point.Value.Position);
            if (item == null || !item.IsValid)
                return;

            Selector sel = item.FindType<Selector>();
            if (sel == null)
                return;
            // Mixins don't have specificity
            if (sel.SimpleSelectors.Count == 1 && sel.SimpleSelectors[0].SubSelectors.Count == 1 && sel.SimpleSelectors[0].SubSelectors[0] is LessMixinDeclaration)
                return;

            applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(item.Start, item.Length, SpanTrackingMode.EdgeNegative);

            string content = GenerateContent(sel);
            qiContent.Add(content);
        }
开发者ID:ncl-dmoreira,项目名称:WebEssentials2013,代码行数:28,代码来源:SelectorQuickInfo.cs

示例9: AugmentQuickInfoSession

            public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
            {
                applicableToSpan = null;

                object eventHookupValue;
                if (quickInfoContent.Count != 0 ||
                    session.Properties.TryGetProperty(QuickInfoUtilities.EventHookupKey, out eventHookupValue))
                {
                    // No quickinfo if it's the event hookup popup.
                    return;
                }

                var position = session.GetTriggerPoint(_subjectBuffer.CurrentSnapshot);
                if (position.HasValue)
                {
                    var textView = session.TextView;
                    var args = new InvokeQuickInfoCommandArgs(textView, _subjectBuffer);

                    Controller controller;
                    if (_commandHandler.TryGetController(args, out controller))
                    {
                        controller.InvokeQuickInfo(position.Value, trackMouse: true, augmentSession: session);
                    }
                }
            }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:25,代码来源:QuickInfoCommandHandlerAndSourceProvider.QuickInfoSource.cs

示例10: AugmentQuickInfoSession

        public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = null;

            if (session == null || qiContent == null || qiContent.Count > 0)
                return;

            // Map the trigger point down to our buffer.
            SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
            if (!point.HasValue)
                return;

            var doc = JSONEditorDocument.FromTextBuffer(_buffer);
            JSONParseItem item = doc.JSONDocument.ItemBeforePosition(point.Value.Position);
            if (item == null || !item.IsValid)
                return;

            JSONMember member = item.FindType<JSONMember>();
            if (member == null || member.Name == null)
                return;

            IJSONSchema schema = _schemaResolver.DetermineSchemaForTextBuffer(_buffer);

            if (schema != null)
            {
                IJSONSchemaPropertyNameCompletionInfo info = GetInfo(schema, member);

                if (info != null && !string.IsNullOrEmpty(info.PropertyDocumentation))
                {
                    applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(item.Start, item.Length, SpanTrackingMode.EdgeNegative);
                    qiContent.Add(info.DisplayText + Environment.NewLine + info.PropertyDocumentation);
                }
            }
        }
开发者ID:GProulx,项目名称:WebEssentials2013,代码行数:34,代码来源:PropertyQuickInfo.cs

示例11: AugmentQuickInfoSession

        public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = null;

            if (!EnsureTreeInitialized() || session == null || qiContent == null)
                return;

            // Map the trigger point down to our buffer.
            SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
            if (!point.HasValue)
                return;

            ParseItem item = _tree.StyleSheet.ItemBeforePosition(point.Value.Position);
            if (item == null || !item.IsValid)
                return;

            RuleSet rule = item.FindType<RuleSet>();
            if (rule == null)
                return;

            applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(item.Start, item.Length, SpanTrackingMode.EdgeNegative);
            var fileName = _buffer.GetFileName().ToLowerInvariant();
            var unmatchedEntry = UsageRegistry.GetAllUnusedRules().FirstOrDefault(x => x.File == fileName && x.Is(rule));

            if(unmatchedEntry == null)
            {
                return;
            }

            qiContent.Add("No usages of this rule have been found");
        }
开发者ID:robert-hoffmann,项目名称:WebEssentials2013,代码行数:31,代码来源:UnusedSelectorQuickInfo.cs

示例12: AugmentQuickInfoSession

        public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }

            if (quickInfoContent == null)
            {
                throw new ArgumentNullException("quickInfoContent");
            }

            TemplateAnalysis analysis = this.analyzer.CurrentAnalysis;
            SnapshotPoint? triggerPoint = session.GetTriggerPoint(analysis.TextSnapshot);
            if (triggerPoint != null && analysis.Template != null)
            {
                string description;
                Span applicableTo;
                if (analysis.Template.TryGetDescription(triggerPoint.Value.Position, out description, out applicableTo))
                {
                    quickInfoContent.Add(description);
                    applicableToSpan = analysis.TextSnapshot.CreateTrackingSpan(applicableTo, SpanTrackingMode.EdgeExclusive); 
                    return;                    
                }
            }

            applicableToSpan = null;
        }
开发者ID:icool123,项目名称:T4Toolbox,代码行数:28,代码来源:TemplateQuickInfoSource.cs

示例13: AugmentQuickInfoSession

        public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = null;

            if (!EnsureTreeInitialized() || session == null || qiContent == null)
                return;

            // Map the trigger point down to our buffer.
            SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
            if (!point.HasValue)
                return;

            ParseItem item = _tree.StyleSheet.ItemBeforePosition(point.Value.Position);
            if (item == null || !item.IsValid)
                return;

            Declaration dec = item.FindType<Declaration>();
            if (dec == null || !dec.IsValid || !_allowed.Contains(dec.PropertyName.Text.ToUpperInvariant()))
                return;

            string fontName = item.Text.Trim('\'', '"');

            if (fonts.Families.SingleOrDefault(f => f.Name.Equals(fontName, StringComparison.OrdinalIgnoreCase)) != null)
            {
                FontFamily font = new FontFamily(fontName);

                applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(item.Start, item.Length, SpanTrackingMode.EdgeNegative);
                qiContent.Add(CreateFontPreview(font, 10));
                qiContent.Add(CreateFontPreview(font, 11));
                qiContent.Add(CreateFontPreview(font, 12));
                qiContent.Add(CreateFontPreview(font, 14));
                qiContent.Add(CreateFontPreview(font, 25));
                qiContent.Add(CreateFontPreview(font, 40));
            }
        }
开发者ID:joeriks,项目名称:WebEssentials2013,代码行数:35,代码来源:FontQuickInfo.cs

示例14: AugmentQuickInfoSession

        public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan) {
            applicableToSpan = null;

            var modifier = ModifierKeys.Control | ModifierKeys.Shift;
            if((Keyboard.Modifiers & modifier) != modifier) {
                return;
            }

            var parseResult = ParserService.ParseResult;
            if (parseResult == null) {
                return;
            }
            // Map the trigger point down to our buffer.
            SnapshotPoint? subjectTriggerPoint = session.GetTriggerPoint(parseResult.Snapshot);
            if(!subjectTriggerPoint.HasValue) {
                return;
            }

            var triggerToken = parseResult.SyntaxTree.Tokens.FindAtPosition(subjectTriggerPoint.Value.Position);

            if(triggerToken.IsMissing || triggerToken.Parent == null) {
                return;
            }

            var location = triggerToken.GetLocation();
            qiContent.Add($"{triggerToken.Type} ({triggerToken.Classification}) Ln {location?.StartLine + 1} Ch {location?.StartCharacter + 1}\r\n{triggerToken.Parent?.GetType().Name}");

            applicableToSpan = parseResult.Snapshot.CreateTrackingSpan(
                triggerToken.Start,
                triggerToken.Length,
                SpanTrackingMode.EdgeExclusive);
        }
开发者ID:IInspectable,项目名称:Nav.Language.Extensions,代码行数:32,代码来源:DebugQuickInfoSource.cs

示例15: AugmentQuickInfoSession

        public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = null;

            SnapshotPoint? point = session.GetTriggerPoint(session.TextView.TextBuffer.CurrentSnapshot);

            if (!point.HasValue)
                return;

            HtmlEditorTree tree = HtmlEditorDocument.FromTextView(session.TextView).HtmlEditorTree;

            ElementNode node = null;
            AttributeNode attr = null;

            tree.GetPositionElement(point.Value.Position, out node, out attr);

            if (node == null || !node.Name.Equals("img", StringComparison.OrdinalIgnoreCase))
                return;
            if (attr == null || !attr.Name.Equals("src", StringComparison.OrdinalIgnoreCase))
                return;

            string url = ImageQuickInfo.GetFullUrl(attr.Value, session.TextView.TextBuffer);
            if (string.IsNullOrEmpty(url))
                return;

            applicableToSpan = session.TextView.TextBuffer.CurrentSnapshot.CreateTrackingSpan(point.Value.Position, 1, SpanTrackingMode.EdgeNegative);

            ImageQuickInfo.AddImageContent(qiContent, url);
        }
开发者ID:Gordon-Beeming,项目名称:WebEssentials2013,代码行数:29,代码来源:ImageQuickInfo.cs


注:本文中的IQuickInfoSession.GetTriggerPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。