Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tmat committed Feb 13, 2022
1 parent fc093a1 commit e7f950f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.FindSymbols;
using Microsoft.CodeAnalysis.FindUsages;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Options;
Expand All @@ -29,22 +30,19 @@ internal sealed class FindDerivedSymbolsCommandHandler :
AbstractNavigationCommandHandler<FindDerivedSymbolsCommandArgs>
{
private readonly IAsynchronousOperationListener _asyncListener;
private readonly IGlobalOptionService _globalOptions;

public override string DisplayName => nameof(FindDerivedSymbolsCommandHandler);

[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public FindDerivedSymbolsCommandHandler(
[ImportMany] IEnumerable<Lazy<IStreamingFindUsagesPresenter>> streamingPresenters,
IAsynchronousOperationListenerProvider listenerProvider,
IGlobalOptionService globalOptions)
IAsynchronousOperationListenerProvider listenerProvider)
: base(streamingPresenters)
{
Contract.ThrowIfNull(listenerProvider);

_asyncListener = listenerProvider.GetListener(FeatureAttribute.FindReferences);
_globalOptions = globalOptions;
}

protected override bool TryExecuteCommand(int caretPosition, Document document, CommandExecutionContext context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.FindUsages;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.Commanding;
using Microsoft.VisualStudio.Text.Editor.Commanding.Commands.Navigation;
using Microsoft.VisualStudio.Utilities;
using Roslyn.Utilities;
using VSCommanding = Microsoft.VisualStudio.Commanding;
using Microsoft.CodeAnalysis.Host.Mef;
using System.Threading;
using Microsoft.CodeAnalysis.FindUsages;

namespace Microsoft.CodeAnalysis.Editor.Implementation.NavigationCommandHandlers
{
Expand All @@ -29,22 +28,19 @@ internal sealed class FindMemberOverloadsCommandHandler :
AbstractNavigationCommandHandler<FindMemberOverloadsCommandArgs>
{
private readonly IAsynchronousOperationListener _asyncListener;
private readonly IGlobalOptionService _globalOptions;

public override string DisplayName => nameof(FindMemberOverloadsCommandHandler);

[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public FindMemberOverloadsCommandHandler(
[ImportMany] IEnumerable<Lazy<IStreamingFindUsagesPresenter>> streamingPresenters,
IAsynchronousOperationListenerProvider listenerProvider,
IGlobalOptionService globalOptions)
IAsynchronousOperationListenerProvider listenerProvider)
: base(streamingPresenters)
{
Contract.ThrowIfNull(listenerProvider);

_asyncListener = listenerProvider.GetListener(FeatureAttribute.FindReferences);
_globalOptions = globalOptions;
}

protected override bool TryExecuteCommand(int caretPosition, Document document, CommandExecutionContext context)
Expand Down
3 changes: 0 additions & 3 deletions src/Features/Core/Portable/FindUsages/FindUsagesContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ namespace Microsoft.CodeAnalysis.FindUsages
{
internal abstract class FindUsagesContext : IFindUsagesContext
{
public readonly IGlobalOptionService GlobalOptions;

public IStreamingProgressTracker ProgressTracker { get; }

protected FindUsagesContext()
{
ProgressTracker = new StreamingProgressTracker(ReportProgressAsync);
GlobalOptions = globalOptions;
}

public abstract ValueTask<FindUsagesOptions> GetOptionsAsync(string language, CancellationToken cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public sealed override ValueTask OnDefinitionFoundAsync(DefinitionItem definitio
CancellationToken cancellationToken)
{
var document = documentSpan.Document;
var options = GlobalOptions.GetClassificationOptions(document.Project.Language);
var options = _globalOptions.GetClassificationOptions(document.Project.Language);
var sourceText = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);
var (excerptResult, lineText) = await ExcerptAsync(sourceText, documentSpan, options, cancellationToken).ConfigureAwait(false);

Expand Down

0 comments on commit e7f950f

Please sign in to comment.