Ejemplo n.º 1
0
        private void ProcessItem(SyntaxToken name, string nameText, TextSpan nodeSpan, string kind, SyntaxNode parent, Glyph icon)
        {
            if (!nodeSpan.IsInRootFile)
            {
                return;
            }

            if (name == null)
            {
                return;
            }

            if (!Contains(name.Text, _searchValue, StringComparison.CurrentCultureIgnoreCase))
            {
                return;
            }

            var description = GetDescription(parent);

            Action navigateCallback = () => _textView.NavigateTo(
                _bufferGraphFactoryService,
                new SnapshotSpan(_snapshot, nodeSpan.Start, nodeSpan.Length),
                new SnapshotSpan(_snapshot, name.Span.Start, name.Span.Length));

            var itemDisplay = new NavigateToItemDisplay(icon.GetIcon(_glyphService),
                                                        nameText, description, null, navigateCallback);

            _callback.AddItem(new NavigateToItem(
                                  name.Text,
                                  kind,
                                  HlslConstants.LanguageName,
                                  name.Text,
                                  itemDisplay,
                                  (name.Text == _searchValue) ? MatchKind.Exact : MatchKind.Substring,
                                  _displayFactory));
        }
Ejemplo n.º 2
0
        private void ProcessItem(SyntaxToken name, string nameText, TextSpan nodeSpan, string kind, SyntaxNode parent, Glyph icon)
        {
            if (!nodeSpan.IsInRootFile)
                return;

            if (name == null)
                return;

            if (!Contains(name.Text, _searchValue, StringComparison.CurrentCultureIgnoreCase))
                return;

            var description = GetDescription(parent);

            Action navigateCallback = () => _textView.NavigateTo(
                _bufferGraphFactoryService,
                new SnapshotSpan(_snapshot, nodeSpan.Start, nodeSpan.Length),
                new SnapshotSpan(_snapshot, name.Span.Start, name.Span.Length));

            var itemDisplay = new NavigateToItemDisplay(icon.GetIcon(_glyphService),
                nameText, description, null, navigateCallback);

            _callback.AddItem(new NavigateToItem(
                name.Text,
                kind,
                HlslConstants.LanguageName,
                name.Text, 
                itemDisplay,
                (name.Text == _searchValue) ? MatchKind.Exact : MatchKind.Substring,
                _displayFactory));
        }