Ejemplo n.º 1
0
            protected async Task <Entry> TryCreateDocumentSpanEntryAsync(
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                HighlightSpanKind spanKind,
                ImmutableDictionary <string, ImmutableArray <string> > propertiesWithMultipleValuesMapOpt,
                ImmutableArray <FindUsageProperty> additionalProperties)
            {
                var document = documentSpan.Document;

                var(guid, projectName, sourceText) = await GetGuidAndProjectNameAndSourceTextAsync(document).ConfigureAwait(false);

                var(excerptResult, lineText) = await ExcerptAsync(sourceText, documentSpan).ConfigureAwait(false);

                var mappedDocumentSpan = await AbstractDocumentSpanEntry.TryMapAndGetFirstAsync(documentSpan, sourceText, CancellationToken).ConfigureAwait(false);

                if (mappedDocumentSpan == null)
                {
                    // this will be removed from the result
                    return(null);
                }

                return(new DocumentSpanEntry(
                           this, definitionBucket, spanKind, projectName,
                           guid, mappedDocumentSpan.Value, excerptResult, lineText, GetCustomColumnsData(propertiesWithMultipleValuesMapOpt, additionalProperties)));
            }
 private SimpleMessageEntry(
     RoslynDefinitionBucket definitionBucket,
     string message)
     : base(definitionBucket)
 {
     _message = message;
 }
 public static Task<Entry> CreateAsync(
     RoslynDefinitionBucket definitionBucket,
     string message)
 {
     var referenceEntry = new SimpleMessageEntry(definitionBucket, message);
     return Task.FromResult<Entry>(referenceEntry);
 }
            private async Task CreateMissingReferenceEntriesIfNecessaryAsync(
                bool whenGroupingByDefinition)
            {
                // Go through and add dummy entries for any definitions that
                // that we didn't find any references for.

                var definitions = GetDefinitionsToCreateMissingReferenceItemsFor(whenGroupingByDefinition);

                foreach (var definition in definitions)
                {
                    if (definition.IsExternal)
                    {
                        await OnEntryFoundAsync(definition,
                                                bucket => SimpleMessageEntry.CreateAsync(bucket, bucket, ServicesVSResources.External_reference_found) !,
                                                addToEntriesWhenGroupingByDefinition : whenGroupingByDefinition,
                                                addToEntriesWhenNotGroupingByDefinition : !whenGroupingByDefinition).ConfigureAwait(false);
                    }
                    else
                    {
                        // Create a fake reference to this definition that says "no references found to <symbolname>".
                        //
                        // We'll place this under a single bucket called "Symbols without references" and we'll allow
                        // the user to navigate on that text entry to that definition if possible.
                        await OnEntryFoundAsync(SymbolsWithoutReferencesDefinitionItem,
                                                bucket => SimpleMessageEntry.CreateAsync(
                                                    definitionBucket: bucket,
                                                    navigationBucket: RoslynDefinitionBucket.Create(Presenter, this, definition, expandedByDefault: false),
                                                    string.Format(ServicesVSResources.No_references_found_to_0, definition.NameDisplayParts.JoinText())) !,
                                                addToEntriesWhenGroupingByDefinition : whenGroupingByDefinition,
                                                addToEntriesWhenNotGroupingByDefinition : !whenGroupingByDefinition,
                                                expandedByDefault : false).ConfigureAwait(false);
                    }
                }
            }
            private async Task <Entry?> TryCreateEntryAsync(
                RoslynDefinitionBucket definitionBucket,
                DefinitionItem definition
                )
            {
                var documentSpan = definition.SourceSpans[0];

                var(guid, projectName, _) = GetGuidAndProjectInfo(documentSpan.Document);
                var sourceText = await documentSpan.Document
                                 .GetTextAsync(CancellationToken)
                                 .ConfigureAwait(false);

                var lineText = AbstractDocumentSpanEntry.GetLineContainingPosition(
                    sourceText,
                    documentSpan.SourceSpan.Start
                    );
                var mappedDocumentSpan = await AbstractDocumentSpanEntry
                                         .TryMapAndGetFirstAsync(documentSpan, sourceText, CancellationToken)
                                         .ConfigureAwait(false);

                if (mappedDocumentSpan == null)
                {
                    // this will be removed from the result
                    return(null);
                }

                return(new DefinitionItemEntry(
                           this,
                           definitionBucket,
                           projectName,
                           guid,
                           lineText,
                           mappedDocumentSpan.Value
                           ));
            }
 public ExternalReferenceItemEntry(
     RoslynDefinitionBucket bucket,
     ExternalReferenceItem reference)
     : base(bucket)
 {
     _reference = reference;
 }
Ejemplo n.º 7
0
 public AbstractItemEntry(
     RoslynDefinitionBucket definitionBucket,
     StreamingFindUsagesPresenter presenter
     ) : base(definitionBucket)
 {
     Presenter = presenter;
 }
            private async Task <Entry> CreateDocumentLocationEntryAsync(
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                bool isDefinitionLocation,
                CancellationToken cancellationToken)
            {
                var document = documentSpan.Document;

                // The FAR system needs to know the guid for the project that a def/reference is
                // from.  So we only support this for documents from a VSWorkspace.
                var workspace = document.Project.Solution.Workspace as VisualStudioWorkspaceImpl;

                if (workspace == null)
                {
                    return(null);
                }

                var projectGuid = workspace.GetHostProject(document.Project.Id)?.Guid;

                if (projectGuid == null)
                {
                    return(null);
                }

                var sourceText = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);

                var referenceSpan = documentSpan.SourceSpan;
                var lineSpan      = GetLineSpanForReference(sourceText, referenceSpan);

                var taggedLineParts = await GetTaggedTextForReferenceAsync(document, referenceSpan, lineSpan, cancellationToken).ConfigureAwait(false);

                return(new DocumentSpanEntry(
                           this, workspace, definitionBucket, documentSpan,
                           isDefinitionLocation, projectGuid.Value, sourceText, taggedLineParts));
            }
Ejemplo n.º 9
0
 private SimpleMessageEntry(
     RoslynDefinitionBucket definitionBucket,
     string message)
     : base(definitionBucket)
 {
     _message = message;
 }
            private async Task <Entry> CreateDocumentLocationEntryAsync(
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                bool isDefinitionLocation)
            {
                var document = documentSpan.Document;

                // The FAR system needs to know the guid for the project that a def/reference is
                // from (to support features like filtering).  Normally that would mean we could
                // only support this from a VisualStudioWorkspace.  However, we want till work
                // in cases lke Any-Code (which does not use a VSWorkspace).  So we are tolerant
                // when we have another type of workspace.  This means we will show results, but
                // certain features (like filtering) may not work in that context.
                var workspace = document.Project.Solution.Workspace as VisualStudioWorkspaceImpl;
                var guid      = workspace?.GetHostProject(document.Project.Id)?.Guid ?? Guid.Empty;

                var sourceText = await document.GetTextAsync(CancellationToken).ConfigureAwait(false);

                var referenceSpan = documentSpan.SourceSpan;
                var lineSpan      = GetLineSpanForReference(sourceText, referenceSpan);

                var taggedLineParts = await GetTaggedTextForReferenceAsync(document, referenceSpan, lineSpan).ConfigureAwait(false);

                return(new DocumentSpanEntry(
                           this, definitionBucket, documentSpan, isDefinitionLocation,
                           guid, sourceText, taggedLineParts));
            }
Ejemplo n.º 11
0
            public static Task <Entry> CreateAsync(
                RoslynDefinitionBucket definitionBucket,
                string message)
            {
                var referenceEntry = new SimpleMessageEntry(definitionBucket, message);

                return(Task.FromResult <Entry>(referenceEntry));
            }
 public MetadataDefinitionItemEntry(
     AbstractTableDataSourceFindUsagesContext context,
     RoslynDefinitionBucket definitionBucket,
     IThreadingContext threadingContext)
     : base(definitionBucket, context.Presenter)
 {
     _threadingContext = threadingContext;
 }
Ejemplo n.º 13
0
 private SimpleMessageEntry(
     RoslynDefinitionBucket definitionBucket,
     RoslynDefinitionBucket?navigationBucket,
     string message)
     : base(definitionBucket)
 {
     _navigationBucket = navigationBucket;
     _message          = message;
 }
            private async Task <Entry> CreateEntryAsync(
                RoslynDefinitionBucket definitionBucket, DefinitionItem definition)
            {
                var documentSpan = definition.SourceSpans[0];

                var(guid, projectName, sourceText) = await GetGuidAndProjectNameAndSourceTextAsync(documentSpan.Document).ConfigureAwait(false);

                return(new DefinitionItemEntry(this, definitionBucket, documentSpan, projectName, guid, sourceText));
            }
Ejemplo n.º 15
0
 public DefinitionItemEntry(
     AbstractTableDataSourceFindUsagesContext context,
     RoslynDefinitionBucket definitionBucket,
     DocumentSpan documentSpan,
     Guid projectGuid,
     SourceText sourceText)
     : base(context, definitionBucket, documentSpan, projectGuid, sourceText)
 {
 }
Ejemplo n.º 16
0
 public DefinitionItemEntry(
     AbstractTableDataSourceFindUsagesContext context,
     RoslynDefinitionBucket definitionBucket,
     string documentName,
     Guid projectGuid,
     SourceText lineText,
     MappedSpanResult mappedSpanResult)
     : base(context, definitionBucket, documentName, projectGuid, lineText, mappedSpanResult)
 {
 }
Ejemplo n.º 17
0
            protected AbstractDocumentSpanEntry(
                AbstractTableDataSourceFindUsagesContext context,
                RoslynDefinitionBucket definitionBucket,
                Guid projectGuid,
                SourceText lineText,
                MappedSpanResult mappedSpanResult
                ) : base(definitionBucket, context.Presenter)
            {
                _boxedProjectGuid = projectGuid;

                _lineText         = lineText;
                _mappedSpanResult = mappedSpanResult;
            }
            protected RoslynDefinitionBucket GetOrCreateDefinitionBucket(DefinitionItem definition)
            {
                lock (Gate)
                {
                    if (!_definitionToBucket.TryGetValue(definition, out var bucket))
                    {
                        bucket = RoslynDefinitionBucket.Create(Presenter, this, definition);
                        _definitionToBucket.Add(definition, bucket);
                    }

                    return(bucket);
                }
            }
Ejemplo n.º 19
0
 public DocumentSpanEntry(
     AbstractTableDataSourceFindUsagesContext context,
     RoslynDefinitionBucket definitionBucket,
     DocumentSpan documentSpan,
     bool isDefinitionLocation,
     Guid projectGuid,
     SourceText sourceText,
     ClassifiedSpansAndHighlightSpan classifiedSpans)
     : base(context, definitionBucket, documentSpan, projectGuid, sourceText)
 {
     _isDefinitionLocation         = isDefinitionLocation;
     _classifiedSpansAndHighlights = classifiedSpans;
 }
            private RoslynDefinitionBucket GetOrCreateDefinitionBucket(DefinitionItem definition)
            {
                lock (_gate)
                {
                    if (!_definitionToBucket.TryGetValue(definition, out var bucket))
                    {
                        bucket = new RoslynDefinitionBucket(Presenter, this, definition);
                        _definitionToBucket.Add(definition, bucket);
                    }

                    return(bucket);
                }
            }
Ejemplo n.º 21
0
 public DocumentSpanEntry(
     AbstractTableDataSourceFindUsagesContext context,
     RoslynDefinitionBucket definitionBucket,
     DocumentSpan documentSpan,
     DocumentHighlighting.HighlightSpanKind spanKind,
     string documentName,
     Guid projectGuid,
     SourceText sourceText,
     ClassifiedSpansAndHighlightSpan classifiedSpans)
     : base(context, definitionBucket, documentSpan, documentName, projectGuid, sourceText)
 {
     _spanKind = spanKind;
     _classifiedSpansAndHighlights = classifiedSpans;
 }
Ejemplo n.º 22
0
            protected AbstractDocumentSpanEntry(
                AbstractTableDataSourceFindUsagesContext context,
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                Guid projectGuid,
                SourceText sourceText)
                : base(definitionBucket)
            {
                _context = context;

                _documentSpan     = documentSpan;
                _boxedProjectGuid = projectGuid;
                _sourceText       = sourceText;
            }
Ejemplo n.º 23
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);
            }
Ejemplo n.º 24
0
            protected async Task <Entry> CreateDocumentSpanEntryAsync(
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                HighlightSpanKind spanKind)
            {
                var document = documentSpan.Document;

                var(guid, projectName, sourceText) = await GetGuidAndProjectNameAndSourceTextAsync(document).ConfigureAwait(false);

                var classifiedSpansAndHighlightSpan =
                    await ClassifiedSpansAndHighlightSpanFactory.ClassifyAsync(documentSpan, CancellationToken).ConfigureAwait(false);

                return(new DocumentSpanEntry(
                           this, definitionBucket, documentSpan, spanKind,
                           projectName, guid, sourceText, classifiedSpansAndHighlightSpan));
            }
            public DocumentSpanEntry(
                TableDataSourceFindUsagesContext context,
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                bool isDefinitionLocation,
                SourceText sourceText,
                ClassifiedSpansAndHighlightSpan classifiedSpans)
                : base(definitionBucket)
            {
                _context = context;

                _documentSpan = documentSpan;
                _isDefinitionLocation = isDefinitionLocation;
                _sourceText = sourceText;
                _classifiedSpans = classifiedSpans;
            }
Ejemplo n.º 26
0
            public DocumentSpanEntry(
                TableDataSourceFindUsagesContext context,
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                bool isDefinitionLocation,
                SourceText sourceText,
                ClassifiedSpansAndHighlightSpan classifiedSpans)
                : base(definitionBucket)
            {
                _context = context;

                _documentSpan         = documentSpan;
                _isDefinitionLocation = isDefinitionLocation;
                _sourceText           = sourceText;
                _classifiedSpans      = classifiedSpans;
            }
            protected async Task<Entry> CreateDocumentSpanEntryAsync(
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                HighlightSpanKind spanKind)
            {
                var document = documentSpan.Document;
                var (guid, sourceText) = await GetGuidAndSourceTextAsync(document).ConfigureAwait(false);

                var narrowSpan = documentSpan.SourceSpan;
                var lineSpan = GetLineSpanForReference(sourceText, narrowSpan);

                var taggedLineParts = await GetTaggedTextForDocumentRegionAsync(document, narrowSpan, lineSpan).ConfigureAwait(false);

                return new DocumentSpanEntry(
                    this, definitionBucket, documentSpan, spanKind,
                    guid, sourceText, taggedLineParts);
            }
            protected async Task <Entry> CreateDocumentSpanEntryAsync(
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                HighlightSpanKind spanKind,
                ImmutableDictionary <string, ImmutableArray <string> > customColumnsDataOpt)
            {
                var document = documentSpan.Document;

                var(guid, projectName, sourceText) = await GetGuidAndProjectNameAndSourceTextAsync(document).ConfigureAwait(false);

                var classifiedSpansAndHighlightSpan =
                    await ClassifiedSpansAndHighlightSpanFactory.ClassifyAsync(documentSpan, CancellationToken).ConfigureAwait(false);

                return(new DocumentSpanEntry(
                           this, definitionBucket, documentSpan, spanKind,
                           projectName, guid, sourceText, classifiedSpansAndHighlightSpan, GetAggregatedCustomColumnsData(customColumnsDataOpt)));
            }
            private async Task <Entry> CreateDocumentLocationEntryAsync(
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                bool isDefinitionLocation)
            {
                var document = documentSpan.Document;

                var sourceText = await document.GetTextAsync(CancellationToken).ConfigureAwait(false);

                var referenceSpan = documentSpan.SourceSpan;
                var lineSpan      = GetLineSpanForReference(sourceText, referenceSpan);

                var taggedLineParts = await GetTaggedTextForReferenceAsync(document, referenceSpan, lineSpan).ConfigureAwait(false);

                return(new DocumentSpanEntry(
                           this, definitionBucket, documentSpan,
                           isDefinitionLocation, sourceText, taggedLineParts));
            }
            public DocumentSpanEntry(
                TableDataSourceFindReferencesContext context,
                VisualStudioWorkspaceImpl workspace,
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                bool isDefinitionLocation,
                Guid projectGuid,
                SourceText sourceText,
                ClassifiedSpansAndHighlightSpan classifiedSpans)
                : base(definitionBucket)
            {
                _context = context;

                _workspace            = workspace;
                _documentSpan         = documentSpan;
                _isDefinitionLocation = isDefinitionLocation;
                _boxedProjectGuid     = projectGuid;
                _sourceText           = sourceText;
                _classifiedSpans      = classifiedSpans;
            }
            public DocumentSpanEntry(
                TableDataSourceFindReferencesContext context,
                VisualStudioWorkspaceImpl workspace,
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                bool isDefinitionLocation,
                Guid projectGuid,
                SourceText sourceText,
                ClassifiedSpansAndHighlightSpan classifiedSpans)
                : base(definitionBucket)
            {
                _context = context;

                _workspace = workspace;
                _documentSpan = documentSpan;
                _isDefinitionLocation = isDefinitionLocation;
                _boxedProjectGuid = projectGuid;
                _sourceText = sourceText;
                _classifiedSpans = classifiedSpans;
            }
            public DocumentLocationEntry(
                TableDataSourceFindReferencesContext context,
                VisualStudioWorkspaceImpl workspace,
                RoslynDefinitionBucket definitionBucket,
                DocumentLocation documentLocation,
                bool isDefinitionLocation,
                Guid projectGuid,
                SourceText sourceText,
                TaggedTextAndHighlightSpan taggedLineParts)
                : base(definitionBucket)
            {
                _context = context;

                _workspace = workspace;
                _documentLocation = documentLocation;
                _isDefinitionLocation = isDefinitionLocation;
                _boxedProjectGuid = projectGuid;
                _sourceText = sourceText;
                _taggedLineParts = taggedLineParts;
            }
            public DocumentLocationEntry(
                TableDataSourceFindReferencesContext context,
                VisualStudioWorkspaceImpl workspace,
                RoslynDefinitionBucket definitionBucket,
                DocumentLocation documentLocation,
                bool isDefinitionLocation,
                Guid projectGuid,
                SourceText sourceText,
                TaggedTextAndHighlightSpan taggedLineParts)
                : base(definitionBucket)
            {
                _context = context;

                _workspace            = workspace;
                _documentLocation     = documentLocation;
                _isDefinitionLocation = isDefinitionLocation;
                _boxedProjectGuid     = projectGuid;
                _sourceText           = sourceText;
                _taggedLineParts      = taggedLineParts;
            }
Ejemplo n.º 34
0
 public DocumentSpanEntry(
     AbstractTableDataSourceFindUsagesContext context,
     RoslynDefinitionBucket definitionBucket,
     HighlightSpanKind spanKind,
     string documentName,
     Guid projectGuid,
     MappedSpanResult mappedSpanResult,
     ExcerptResult excerptResult,
     SourceText lineText,
     ImmutableDictionary <string, string> customColumnsData)
     : base(context,
            definitionBucket,
            documentName,
            projectGuid,
            lineText,
            mappedSpanResult)
 {
     _spanKind          = spanKind;
     _excerptResult     = excerptResult;
     _customColumnsData = customColumnsData;
 }
Ejemplo n.º 35
0
            private DocumentSpanEntry(
                AbstractTableDataSourceFindUsagesContext context,
                RoslynDefinitionBucket definitionBucket,
                string rawProjectName,
                string?projectFlavor,
                Guid projectGuid,
                HighlightSpanKind spanKind,
                MappedSpanResult mappedSpanResult,
                ExcerptResult excerptResult,
                SourceText lineText,
                SymbolUsageInfo symbolUsageInfo,
                ImmutableDictionary <string, string> customColumnsData)
                : base(context, definitionBucket, projectGuid, lineText, mappedSpanResult)
            {
                _spanKind             = spanKind;
                _excerptResult        = excerptResult;
                _symbolReferenceKinds = symbolUsageInfo.ToSymbolReferenceKinds();
                _customColumnsData    = customColumnsData;

                _rawProjectName = rawProjectName;
                this.AddFlavor(projectFlavor);
            }
            private async Task<Entry> CreateDocumentLocationEntryAsync(
                RoslynDefinitionBucket definitionBucket, 
                DocumentSpan documentSpan,
                bool isDefinitionLocation,
                CancellationToken cancellationToken)
            {
                var document = documentSpan.Document;

                // The FAR system needs to know the guid for the project that a def/reference is 
                // from.  So we only support this for documents from a VSWorkspace.
                var workspace = document.Project.Solution.Workspace as VisualStudioWorkspaceImpl;
                if (workspace == null)
                {
                    return null;
                }

                var projectGuid = workspace.GetHostProject(document.Project.Id)?.Guid;
                if (projectGuid == null)
                {
                    return null;
                }

                var sourceText = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);

                var referenceSpan = documentSpan.SourceSpan;
                var lineSpan = GetLineSpanForReference(sourceText, referenceSpan);

                var taggedLineParts = await GetTaggedTextForReferenceAsync(document, referenceSpan, lineSpan, cancellationToken).ConfigureAwait(false);

                return new DocumentSpanEntry(
                    this, workspace, definitionBucket, documentSpan, 
                    isDefinitionLocation, projectGuid.Value, sourceText, taggedLineParts);
            }
            private async Task<Entry> CreateDocumentLocationEntryAsync(
                RoslynDefinitionBucket definitionBucket, 
                DocumentSpan documentSpan,
                bool isDefinitionLocation)
            {
                var document = documentSpan.Document;

                var sourceText = await document.GetTextAsync(CancellationToken).ConfigureAwait(false);

                var referenceSpan = documentSpan.SourceSpan;
                var lineSpan = GetLineSpanForReference(sourceText, referenceSpan);

                var taggedLineParts = await GetTaggedTextForReferenceAsync(document, referenceSpan, lineSpan).ConfigureAwait(false);

                return new DocumentSpanEntry(
                    this, definitionBucket, documentSpan, 
                    isDefinitionLocation, sourceText, taggedLineParts);
            }
 protected Entry(RoslynDefinitionBucket definitionBucket)
 {
     DefinitionBucket = definitionBucket;
 }
            private RoslynDefinitionBucket GetOrCreateDefinitionBucket(DefinitionItem definition)
            {
                lock (_gate)
                {
                    RoslynDefinitionBucket bucket;
                    if (!_definitionToBucket.TryGetValue(definition, out bucket))
                    {
                        bucket = new RoslynDefinitionBucket(Presenter, this, definition);
                        _definitionToBucket.Add(definition, bucket);
                    }

                    return bucket;
                }
            }