Esempio n. 1
0
            public SearchResult(
                Document document, DeclaredSymbolInfo declaredSymbolInfo, string kind,
                NavigateToMatchKind matchKind, bool isCaseSensitive, INavigableItem navigableItem,
                ImmutableArray <TextSpan> nameMatchSpans)
            {
                Document           = document;
                DeclaredSymbolInfo = declaredSymbolInfo;
                Kind            = kind;
                MatchKind       = matchKind;
                IsCaseSensitive = isCaseSensitive;
                NavigableItem   = navigableItem;
                NameMatchSpans  = nameMatchSpans;

                _lazyAdditionalInfo = new Lazy <string>(() =>
                {
                    switch (declaredSymbolInfo.Kind)
                    {
                    case DeclaredSymbolInfoKind.Class:
                    case DeclaredSymbolInfoKind.Enum:
                    case DeclaredSymbolInfoKind.Interface:
                    case DeclaredSymbolInfoKind.Module:
                    case DeclaredSymbolInfoKind.Struct:
                        if (!declaredSymbolInfo.IsNestedType)
                        {
                            return(string.Format(FeaturesResources.project_0, document.Project.Name));
                        }
                        break;
                    }

                    return(string.Format(FeaturesResources.in_0_project_1, declaredSymbolInfo.ContainerDisplayName, document.Project.Name));
                });
            }
Esempio n. 2
0
            private PatternMatchKind GetPatternMatchKind(NavigateToMatchKind matchKind)
            {
                switch (matchKind)
                {
                case NavigateToMatchKind.Exact: return(PatternMatchKind.Exact);

                case NavigateToMatchKind.Prefix: return(PatternMatchKind.Prefix);

                case NavigateToMatchKind.Substring: return(PatternMatchKind.Substring);

                case NavigateToMatchKind.Regular: return(PatternMatchKind.Fuzzy);

                case NavigateToMatchKind.None: return(PatternMatchKind.Fuzzy);

                case NavigateToMatchKind.CamelCaseExact: return(PatternMatchKind.CamelCaseExact);

                case NavigateToMatchKind.CamelCasePrefix: return(PatternMatchKind.CamelCasePrefix);

                case NavigateToMatchKind.CamelCaseNonContiguousPrefix: return(PatternMatchKind.CamelCaseNonContiguousPrefix);

                case NavigateToMatchKind.CamelCaseSubstring: return(PatternMatchKind.CamelCaseSubstring);

                case NavigateToMatchKind.CamelCaseNonContiguousSubstring: return(PatternMatchKind.CamelCaseNonContiguousSubstring);

                case NavigateToMatchKind.Fuzzy: return(PatternMatchKind.Fuzzy);

                default: throw ExceptionUtilities.UnexpectedValue(matchKind);
                }
            }
            public SearchResult(
                Document document, DeclaredSymbolInfo declaredSymbolInfo, string kind,
                NavigateToMatchKind matchKind, bool isCaseSensitive, INavigableItem navigableItem,
                ImmutableArray <TextSpan> nameMatchSpans)
            {
                _document           = document;
                _declaredSymbolInfo = declaredSymbolInfo;
                Kind            = kind;
                MatchKind       = matchKind;
                IsCaseSensitive = isCaseSensitive;
                NavigableItem   = navigableItem;
                NameMatchSpans  = nameMatchSpans;
                SecondarySort   = ConstructSecondarySortString(document, declaredSymbolInfo);

                var declaredNavigableItem = navigableItem as NavigableItemFactory.DeclaredSymbolNavigableItem;

                Debug.Assert(declaredNavigableItem != null);

                _lazyAdditionalInfo = new Lazy <string>(() =>
                {
                    switch (declaredSymbolInfo.Kind)
                    {
                    case DeclaredSymbolInfoKind.Class:
                    case DeclaredSymbolInfoKind.Enum:
                    case DeclaredSymbolInfoKind.Interface:
                    case DeclaredSymbolInfoKind.Module:
                    case DeclaredSymbolInfoKind.Struct:
                        return(FeaturesResources.project_space + document.Project.Name);

                    default:
                        return(FeaturesResources.type_space + declaredSymbolInfo.ContainerDisplayName);
                    }
                });
            }
            public SearchResult(
                Document document, DeclaredSymbolInfo declaredSymbolInfo, string kind, 
                NavigateToMatchKind matchKind, bool isCaseSensitive, INavigableItem navigableItem)
            {
                _document = document;
                _declaredSymbolInfo = declaredSymbolInfo;
                Kind = kind;
                MatchKind = matchKind;
                IsCaseSensitive = isCaseSensitive;
                NavigableItem = navigableItem;
                SecondarySort = ConstructSecondarySortString(declaredSymbolInfo);

                var declaredNavigableItem = navigableItem as NavigableItemFactory.DeclaredSymbolNavigableItem;
                Debug.Assert(declaredNavigableItem != null);

                _lazySummary = new Lazy<string>(() => declaredNavigableItem.Symbol?.GetDocumentationComment()?.SummaryText);
                _lazyAdditionalInfo = new Lazy<string>(() =>
                {
                    switch (declaredSymbolInfo.Kind)
                    {
                        case DeclaredSymbolInfoKind.Class:
                        case DeclaredSymbolInfoKind.Enum:
                        case DeclaredSymbolInfoKind.Interface:
                        case DeclaredSymbolInfoKind.Module:
                        case DeclaredSymbolInfoKind.Struct:
                            return FeaturesResources.project_space + document.Project.Name;
                        default:
                            return FeaturesResources.type_space + declaredSymbolInfo.ContainerDisplayName;
                    }
                });
            }
Esempio n. 5
0
 public NavigateToSearchResult(string additionalInformation, string kind, NavigateToMatchKind matchKind, bool isCaseSensitive, string name, string secondarySort, string summary, INavigableItem navigableItem)
 {
     AdditionalInformation = additionalInformation;
     Kind = kind;
     MatchKind = matchKind;
     IsCaseSensitive = isCaseSensitive;
     Name = name;
     SecondarySort = secondarySort;
     Summary = summary;
     NavigableItem = navigableItem;
 }
Esempio n. 6
0
 public NavigateToSearchResult(string additionalInformation, string kind, NavigateToMatchKind matchKind, bool isCaseSensitive, string name, string secondarySort, string summary, INavigableItem navigableItem)
 {
     AdditionalInformation = additionalInformation;
     Kind            = kind;
     MatchKind       = matchKind;
     IsCaseSensitive = isCaseSensitive;
     Name            = name;
     SecondarySort   = secondarySort;
     Summary         = summary;
     NavigableItem   = navigableItem;
 }
Esempio n. 7
0
 public SearchResult(
     LogicalDocument document, ISymbol declaredSymbol, string kind,
     NavigateToMatchKind matchKind, bool isCaseSensitive, INavigableItem navigableItem)
 {
     _document       = document;
     _declaredSymbol = declaredSymbol;
     Kind            = kind;
     MatchKind       = matchKind;
     IsCaseSensitive = isCaseSensitive;
     NavigableItem   = navigableItem;
     //SecondarySort = ConstructSecondarySortString(document, declaredSymbolInfo);
     SecondarySort = null;
 }
Esempio n. 8
0
            private MatchKind GetMatchKind(NavigateToMatchKind matchKind)
            {
                switch (matchKind)
                {
                case NavigateToMatchKind.Exact: return(MatchKind.Exact);

                case NavigateToMatchKind.Prefix: return(MatchKind.Prefix);

                case NavigateToMatchKind.Substring: return(MatchKind.Substring);

                case NavigateToMatchKind.Regular: return(MatchKind.Regular);

                default: return(MatchKind.None);
                }
            }
 public SearchResult(
     Document document,
     DeclaredSymbolInfo declaredSymbolInfo,
     string kind,
     NavigateToMatchKind matchKind,
     bool isCaseSensitive,
     INavigableItem navigableItem,
     ImmutableArray <TextSpan> nameMatchSpans,
     ImmutableArray <Project> additionalMatchingProjects)
 {
     Name                  = declaredSymbolInfo.Name;
     Kind                  = kind;
     MatchKind             = matchKind;
     IsCaseSensitive       = isCaseSensitive;
     NavigableItem         = navigableItem;
     NameMatchSpans        = nameMatchSpans;
     AdditionalInformation = ComputeAdditionalInformation(document, declaredSymbolInfo, additionalMatchingProjects);
     SecondarySort         = ConstructSecondarySortString(document, declaredSymbolInfo);
 }
Esempio n. 10
0
 public RoslynNavigateToItem(
     bool isStale,
     DocumentId documentId,
     ImmutableArray <ProjectId> additionalMatchingProjects,
     DeclaredSymbolInfo declaredSymbolInfo,
     string kind,
     NavigateToMatchKind matchKind,
     bool isCaseSensitive,
     ImmutableArray <TextSpan> nameMatchSpans)
 {
     IsStale    = isStale;
     DocumentId = documentId;
     AdditionalMatchingProjects = additionalMatchingProjects;
     DeclaredSymbolInfo         = declaredSymbolInfo;
     Kind            = kind;
     MatchKind       = matchKind;
     IsCaseSensitive = isCaseSensitive;
     NameMatchSpans  = nameMatchSpans;
 }
Esempio n. 11
0
 public SerializableNavigateToSearchResult(
     string additionalInformation,
     string kind,
     NavigateToMatchKind matchKind,
     bool isCaseSensitive,
     string name,
     ImmutableArray <TextSpan> nameMatchSpans,
     string secondarySort,
     string summary,
     SerializableNavigableItem navigableItem)
 {
     AdditionalInformation = additionalInformation;
     Kind            = kind;
     MatchKind       = matchKind;
     IsCaseSensitive = isCaseSensitive;
     Name            = name;
     NameMatchSpans  = nameMatchSpans;
     SecondarySort   = secondarySort;
     Summary         = summary;
     NavigableItem   = navigableItem;
 }
        private static IEnumerable <INavigateToSearchResult> ConvertResult(
            ISymbol declaredSymbol, Document document, SyntaxTreeBase syntaxTree,
            NavigateToMatchKind matchKind)
        {
            var isCaseSensitive = false;
            var kind            = GetItemKind(declaredSymbol.Kind);

            foreach (var location in declaredSymbol.Locations)
            {
                var sourceFileSpan = syntaxTree.GetSourceFileSpan(location);

                if (sourceFileSpan.IsInRootFile)
                {
                    var navigableItem = NavigableItemFactory.GetItemFromDeclaredSymbol(
                        declaredSymbol, document, sourceFileSpan);

                    yield return(new SearchResult(
                                     document, declaredSymbol, kind, matchKind,
                                     isCaseSensitive, navigableItem));
                }
            }
        }
 private static PatternMatchKind GetPatternMatchKind(NavigateToMatchKind matchKind) =>
 matchKind switch
 {
 private MatchKind GetMatchKind(NavigateToMatchKind matchKind)
 {
     switch (matchKind)
     {
         case NavigateToMatchKind.Exact: return MatchKind.Exact;
         case NavigateToMatchKind.Prefix: return MatchKind.Prefix;
         case NavigateToMatchKind.Substring: return MatchKind.Substring;
         case NavigateToMatchKind.Regular: return MatchKind.Regular;
         default: return MatchKind.None;
     }
 }