Skip to content

Commit

Permalink
existing code loaded everyone in VS who MEF exported ITableColumnDefi…
Browse files Browse the repository at this point in the history
…nition. now we make sure we only load one that we care (#36562)
  • Loading branch information
heejaechang authored Jun 19, 2019
1 parent 91c7543 commit cc909f1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Collections.Generic;
using Roslyn.Utilities;

namespace Microsoft.VisualStudio.LanguageServices.FindUsages
{
internal class NameMetadata
{
public string Name { get; }

public NameMetadata(IDictionary<string, object> data)
{
this.Name = (string)data.GetValueOrDefault(nameof(Name));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Microsoft.VisualStudio.Shell.FindAllReferences;
using Microsoft.VisualStudio.Shell.TableControl;
using Microsoft.VisualStudio.Text.Classification;
using EnvDTE;

namespace Microsoft.VisualStudio.LanguageServices.FindUsages
{
Expand Down Expand Up @@ -50,8 +51,14 @@ public StreamingFindUsagesPresenter(
ClassificationTypeMap typeMap,
IEditorFormatMapService formatMapService,
IClassificationFormatMapService classificationFormatMapService,
[ImportMany]IEnumerable<ITableColumnDefinition> columns)
: this(workspace, threadingContext, serviceProvider, typeMap, formatMapService, classificationFormatMapService, columns)
[ImportMany]IEnumerable<Lazy<ITableColumnDefinition, NameMetadata>> columns)
: this(workspace,
threadingContext,
serviceProvider,
typeMap,
formatMapService,
classificationFormatMapService,
columns.Where(c => c.Metadata.Name == FindUsagesValueUsageInfoColumnDefinition.ColumnName).Select(c => c.Value))
{
}

Expand Down

0 comments on commit cc909f1

Please sign in to comment.