示例#1
0
        public bool TryGoToDefinition(Document document, int position, CancellationToken cancellationToken)
        {
            var symbol = FindSymbolAsync(document, position, cancellationToken).WaitAndGetResult(cancellationToken);

            if (symbol != null)
            {
                var containingTypeSymbol = GetContainingTypeSymbol(position, document, cancellationToken);

                if (GoToDefinitionHelpers.TryGoToDefinition(symbol, document.Project, _presenters, containingTypeSymbol, throwOnHiddenDefinition: true, cancellationToken: cancellationToken))
                {
                    return(true);
                }
            }

            return(false);
        }
示例#2
0
        public bool TryGoToDefinition(Document document, int position, CancellationToken cancellationToken)
        {
            // First try to compute the referenced symbol and attempt to go to definition for the symbol.
            var symbol = FindSymbolAsync(document, position, cancellationToken).WaitAndGetResult(cancellationToken);

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

            var isThirdPartyNavigationAllowed = IsThirdPartyNavigationAllowed(symbol, position, document, cancellationToken);

            return(GoToDefinitionHelpers.TryGoToDefinition(symbol,
                                                           document.Project,
                                                           _presenters,
                                                           _streamingPresenters,
                                                           thirdPartyNavigationAllowed: isThirdPartyNavigationAllowed,
                                                           throwOnHiddenDefinition: true,
                                                           cancellationToken: cancellationToken));
        }
示例#3
0
        public bool TryGoToDefinition(Document document, int position, CancellationToken cancellationToken)
        {
            var symbol = FindSymbolAsync(document, position, cancellationToken).WaitAndGetResult(cancellationToken);

            if (symbol != null)
            {
                var isThirdPartyNavigationAllowed = IsThirdPartyNavigationAllowed(symbol, position, document, cancellationToken);

                if (GoToDefinitionHelpers.TryGoToDefinition(symbol,
                                                            document.Project,
                                                            _presenters,
                                                            thirdPartyNavigationAllowed: isThirdPartyNavigationAllowed,
                                                            throwOnHiddenDefinition: true,
                                                            cancellationToken: cancellationToken))
                {
                    return(true);
                }
            }

            return(false);
        }
示例#4
0
        public bool TryGoToDefinition(Document document, int position, CancellationToken cancellationToken)
        {
            // First try to compute the referenced symbol and attempt to go to definition for the symbol.
            var symbol = FindSymbolAsync(document, position, cancellationToken).WaitAndGetResult(cancellationToken);

            if (symbol != null)
            {
                var isThirdPartyNavigationAllowed = IsThirdPartyNavigationAllowed(symbol, position, document, cancellationToken);

                return(GoToDefinitionHelpers.TryGoToDefinition(symbol,
                                                               document.Project,
                                                               _externalDefinitionProviders,
                                                               _presenters,
                                                               thirdPartyNavigationAllowed: isThirdPartyNavigationAllowed,
                                                               throwOnHiddenDefinition: true,
                                                               cancellationToken: cancellationToken));
            }

            // Otherwise, fallback to the external navigation definition providers.
            return(GoToDefinitionHelpers.TryExternalGoToDefinition(document, position, _externalDefinitionProviders, _presenters, cancellationToken));
        }