Exemplo n.º 1
0
            public DocumentSpanEntry GetOrAddEntry(DocumentSpan documentSpan, DocumentSpanEntry entry)
            {
                var key = (documentSpan.Document.FilePath, documentSpan.SourceSpan);

                lock (_locationToEntry)
                {
                    return(_locationToEntry.GetOrAdd(key, entry));
                }
            }
Exemplo n.º 2
0
            public static DocumentSpanEntry?TryCreate(
                AbstractTableDataSourceFindUsagesContext context,
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                HighlightSpanKind spanKind,
                MappedSpanResult mappedSpanResult,
                ExcerptResult excerptResult,
                SourceText lineText,
                SymbolUsageInfo symbolUsageInfo,
                ImmutableDictionary <string, string> customColumnsData
                )
            {
                var document = documentSpan.Document;

                var(guid, projectName, projectFlavor) = GetGuidAndProjectInfo(document);
                var entry = new DocumentSpanEntry(
                    context,
                    definitionBucket,
                    projectName,
                    projectFlavor,
                    guid,
                    spanKind,
                    mappedSpanResult,
                    excerptResult,
                    lineText,
                    symbolUsageInfo,
                    customColumnsData
                    );

                // Because of things like linked files, we may have a reference up in multiple
                // different locations that are effectively at the exact same navigation location
                // for the user. i.e. they're the same file/span.  Showing multiple entries for these
                // is just noisy and gets worse and worse with shared projects and whatnot.  So, we
                // collapse things down to only show a single entry for each unique file/span pair.
                var winningEntry = definitionBucket.GetOrAddEntry(documentSpan, entry);

                // If we were the one that successfully added this entry to the bucket, then pass us
                // back out to be put in the ui.
                if (winningEntry == entry)
                {
                    return(entry);
                }

                // We were not the winner.  Add our flavor to the entry that already exists, but throw
                // away the item we created as we do not want to add it to the ui.
                winningEntry.AddFlavor(projectFlavor);
                return(null);
            }
Exemplo n.º 3
0
            public DocumentSpanEntry GetOrAddEntry(string?filePath, TextSpan sourceSpan, DocumentSpanEntry entry)
            {
                var key = (filePath, sourceSpan);

                lock (_locationToEntry)
                {
                    return(_locationToEntry.GetOrAdd(key, entry));
                }
            }