Skip to content

Commit

Permalink
Remove dependency on EditorFeatures from Remote.ServieHub project - t…
Browse files Browse the repository at this point in the history
…ake 3 (#59316)

* Revert "Revert "Remove dependency on EditorFeatures from Remote.ServiceHub project - take 2 (#59147)" (#59242)"

This reverts commit 8d81aa5.

* Move GoToBaseService to Features

* Remove unnecessray PackageRefs

* Fixes
  • Loading branch information
tmat authored Feb 11, 2022
1 parent 709fde6 commit ecfd5b1
Show file tree
Hide file tree
Showing 131 changed files with 835 additions and 698 deletions.
2 changes: 1 addition & 1 deletion eng/targets/Services.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.UnusedReferenceAnalysis" ClassName="Microsoft.CodeAnalysis.Remote.RemoteUnusedReferenceAnalysisService+Factory" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.ProcessTelemetry" ClassName="Microsoft.CodeAnalysis.Remote.RemoteProcessTelemetryService+Factory" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.CompilationAvailable" ClassName="Microsoft.CodeAnalysis.Remote.RemoteCompilationAvailableService+Factory" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.StackTraceExplorer" ClassName="Microsoft.CodeAnalysis.Remote.Services.StackTraceExplorer.RemoteStackTraceExplorerService+Factory" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.StackTraceExplorer" ClassName="Microsoft.CodeAnalysis.Remote.RemoteStackTraceExplorerService+Factory" />
</ItemGroup>

<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private static Document PerformDecompilation(Document document, string fullName,

if (file is null && assemblyLocation is null)
{
throw new NotSupportedException(EditorFeaturesResources.Cannot_navigate_to_the_symbol_under_the_caret);
throw new NotSupportedException(FeaturesResources.Cannot_navigate_to_the_symbol_under_the_caret);
}

file ??= new PEFile(assemblyLocation, PEStreamOptions.PrefetchEntireImage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System;
using System.Composition;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.FindUsages;
using Microsoft.CodeAnalysis.Host.Mef;

namespace Microsoft.CodeAnalysis.Editor.CSharp.FindUsages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using System;
using System.Composition;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.FindUsages;
using Microsoft.CodeAnalysis.Host.Mef;

namespace Microsoft.CodeAnalysis.Editor.CSharp.FindUsages
Expand Down
4 changes: 2 additions & 2 deletions src/EditorFeatures/CSharp/GoToBase/CSharpGoToBaseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

using System;
using System.Composition;
using Microsoft.CodeAnalysis.Editor.GoToBase;
using Microsoft.CodeAnalysis.GoToBase;
using Microsoft.CodeAnalysis.Host.Mef;

namespace Microsoft.CodeAnalysis.Editor.CSharp.GoToBase
namespace Microsoft.CodeAnalysis.CSharp.GoToBase
{
[ExportLanguageService(typeof(IGoToBaseService), LanguageNames.CSharp), Shared]
internal class CSharpGoToBaseService : AbstractGoToBaseService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.FindUsages;
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.Extensions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.ComponentModel.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.FindSymbols;
Expand All @@ -20,6 +19,7 @@
using Roslyn.Utilities;
using VSCommanding = Microsoft.VisualStudio.Commanding;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.FindUsages;

namespace Microsoft.CodeAnalysis.Editor.Implementation.NavigationCommandHandlers
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
using System.ComponentModel.Composition;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.FindUsages;
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.Shared.Extensions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using System.ComponentModel.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.FindUsages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Internal.Log;
Expand All @@ -19,6 +18,7 @@
using VSCommanding = Microsoft.VisualStudio.Commanding;
using Microsoft.CodeAnalysis.Host.Mef;
using System.Threading;
using Microsoft.CodeAnalysis.FindUsages;

namespace Microsoft.CodeAnalysis.Editor.Implementation.NavigationCommandHandlers
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
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.Shared.Extensions;
Expand Down
3 changes: 1 addition & 2 deletions src/EditorFeatures/Core.Wpf/Peek/PeekableItemFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.Editor.Peek;
using Microsoft.CodeAnalysis.FindSymbols;
using Microsoft.CodeAnalysis.FindUsages;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.MetadataAsSource;
using Microsoft.CodeAnalysis.Navigation;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Language.Intellisense;

namespace Microsoft.CodeAnalysis.Editor.Implementation.Peek
Expand Down
15 changes: 0 additions & 15 deletions src/EditorFeatures/Core/EditorFeaturesResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,6 @@ Do you want to proceed?</value>
<data name="Go_To_Base" xml:space="preserve">
<value>Go To Base</value>
</data>
<data name="The_symbol_has_no_implementations" xml:space="preserve">
<value>The symbol has no implementations.</value>
</data>
<data name="New_name_colon_0" xml:space="preserve">
<value>New name: {0}</value>
</data>
Expand All @@ -742,12 +739,6 @@ Do you want to proceed?</value>
<data name="Suggestion_ellipses" xml:space="preserve">
<value>Suggestion ellipses (…)</value>
</data>
<data name="_0_references" xml:space="preserve">
<value>'{0}' references</value>
</data>
<data name="_0_implementations" xml:space="preserve">
<value>'{0}' implementations</value>
</data>
<data name="_0_declarations" xml:space="preserve">
<value>'{0}' declarations</value>
</data>
Expand Down Expand Up @@ -886,12 +877,6 @@ Do you want to proceed?</value>
<data name="Waiting_for_background_work_to_finish" xml:space="preserve">
<value>Waiting for background work to finish...</value>
</data>
<data name="The_symbol_has_no_base" xml:space="preserve">
<value>The symbol has no base.</value>
</data>
<data name="_0_bases" xml:space="preserve">
<value>'{0}' bases</value>
</data>
<data name="Rename_symbols_file" xml:space="preserve">
<value>Rename symbol's _file</value>
<comment>Indicates that the file a symbol is defined in will also be renamed</comment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api;
using Microsoft.CodeAnalysis.FindUsages;
using Microsoft.CodeAnalysis.Host.Mef;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.ComponentModel.Composition;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.ErrorReporting;
Expand Down
10 changes: 8 additions & 2 deletions src/EditorFeatures/Core/FindUsages/SimpleFindUsagesContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.FindUsages;
using Microsoft.CodeAnalysis.Options;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.Editor.FindUsages
namespace Microsoft.CodeAnalysis.FindUsages
{
/// <summary>
/// Simple implementation of a <see cref="FindUsagesContext"/> that just aggregates the results
Expand All @@ -19,20 +20,25 @@ namespace Microsoft.CodeAnalysis.Editor.FindUsages
internal sealed class SimpleFindUsagesContext : FindUsagesContext
{
private readonly object _gate = new();
private readonly IGlobalOptionService _globalOptions;

private readonly ImmutableArray<DefinitionItem>.Builder _definitionItems =
ImmutableArray.CreateBuilder<DefinitionItem>();

private readonly ImmutableArray<SourceReferenceItem>.Builder _referenceItems =
ImmutableArray.CreateBuilder<SourceReferenceItem>();

public SimpleFindUsagesContext(IGlobalOptionService globalOptions)
: base(globalOptions)
{
_globalOptions = globalOptions;
}

public string Message { get; private set; }
public string SearchTitle { get; private set; }

public override ValueTask<FindUsagesOptions> GetOptionsAsync(string language, CancellationToken cancellationToken)
=> ValueTaskFactory.FromResult(_globalOptions.GetFindUsagesOptions(language));

public override ValueTask ReportMessageAsync(string message, CancellationToken cancellationToken)
{
Message = message;
Expand Down
3 changes: 2 additions & 1 deletion src/EditorFeatures/Core/GoToBase/GoToBaseCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.ComponentModel.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Editor.CommandHandlers;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
Expand All @@ -19,7 +20,7 @@
using Microsoft.VisualStudio.Utilities;
using VSCommanding = Microsoft.VisualStudio.Commanding;

namespace Microsoft.CodeAnalysis.Editor.GoToBase
namespace Microsoft.CodeAnalysis.GoToBase
{
[Export(typeof(VSCommanding.ICommandHandler))]
[ContentType(ContentTypeNames.RoslynContentType)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.FindUsages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ internal static bool TryExecuteCommand(Document document, int caretPosition, IGo
return true;
}

errorMessage = EditorFeaturesResources.Cannot_navigate_to_the_symbol_under_the_caret;
errorMessage = FeaturesResources.Cannot_navigate_to_the_symbol_under_the_caret;
}

if (errorMessage != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.FindSymbols;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.CommandHandlers;
using Microsoft.CodeAnalysis.Editor.Commanding.Commands;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.FindUsages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public TagComputer(
_typeMap = typeMap;
_diffTimeout = diffTimeout;
_workQueue = new AsyncBatchingWorkQueue<ITextSnapshot>(
TimeSpan.FromMilliseconds(TaggerConstants.NearImmediateDelay),
DelayTimeSpan.NearImmediate,
ProcessChangesAsync,
equalityComparer: null,
asyncListener,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.Editor.GoToDefinition;
using Microsoft.CodeAnalysis.Editor.Shared.Options;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.FindSymbols;
using Microsoft.CodeAnalysis.FindUsages;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.MetadataAsSource;
using Microsoft.CodeAnalysis.Navigation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.FindUsages;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.LanguageServer.CustomProtocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.FindUsages;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ internal sealed class FindUsagesLSPContext : FindUsagesContext
private readonly Document _document;
private readonly int _position;
private readonly IMetadataAsSourceFileService _metadataAsSourceFileService;
private readonly IGlobalOptionService _globalOptions;

/// <summary>
/// Methods in FindUsagesLSPContext can be called by multiple threads concurrently.
Expand Down Expand Up @@ -78,16 +79,19 @@ public FindUsagesLSPContext(
IAsynchronousOperationListener asyncListener,
IGlobalOptionService globalOptions,
CancellationToken cancellationToken)
: base(globalOptions)
{
_progress = progress;
_document = document;
_position = position;
_metadataAsSourceFileService = metadataAsSourceFileService;
_globalOptions = globalOptions;
_workQueue = new AsyncBatchingWorkQueue<VSInternalReferenceItem>(
TimeSpan.FromMilliseconds(500), ReportReferencesAsync, asyncListener, cancellationToken);
}

public override ValueTask<FindUsagesOptions> GetOptionsAsync(string language, CancellationToken cancellationToken)
=> ValueTaskFactory.FromResult(_globalOptions.GetFindUsagesOptions(language));

// After all definitions/references have been found, wait here until all results have been reported.
public override async ValueTask OnCompletedAsync(CancellationToken cancellationToken)
=> await _workQueue.WaitUntilCurrentBatchCompletesAsync().ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ public NavigationBarController(
_asyncListener = asyncListener;

_computeModelQueue = new AsyncBatchingWorkQueue<bool, NavigationBarModel?>(
TimeSpan.FromMilliseconds(TaggerConstants.ShortDelay),
DelayTimeSpan.Short,
ComputeModelAndSelectItemAsync,
EqualityComparer<bool>.Default,
asyncListener,
_cancellationTokenSource.Token);

_selectItemQueue = new AsyncBatchingWorkQueue(
TimeSpan.FromMilliseconds(TaggerConstants.NearImmediateDelay),
DelayTimeSpan.NearImmediate,
SelectItemAsync,
asyncListener,
_cancellationTokenSource.Token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
<ProjectReference Include="..\..\Scripting\Core\Microsoft.CodeAnalysis.Scripting.csproj" Aliases="Scripting,global" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Elfie" Version="$(MicrosoftCodeAnalysisElfieVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Language.StandardClassification" Version="$(MicrosoftVisualStudioLanguageStandardClassificationVersion)" />
<PackageReference Include="Microsoft.VisualStudio.RemoteControl" Version="$(MicrosoftVisualStudioRemoteControlVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Text.UI" Version="$(MicrosoftVisualStudioTextUIVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="$(MicrosoftVisualStudioThreadingVersion)" />
<!-- The ImageCatalog reference is only used at compile time, not at runtime, because it is not supported on Mac.
Expand Down
Loading

0 comments on commit ecfd5b1

Please sign in to comment.