Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLVS-1620 Remove unused AbsoluteFilePathLocator & IFolderWorkspaceMonitor #5937

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions src/Core/IFolderWorkspaceMonitor.cs

This file was deleted.

185 changes: 0 additions & 185 deletions src/Integration.UnitTests/Helpers/AbsoluteFilePathLocatorTests.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -112,28 +112,11 @@ public void ActiveSolutionTracker_RaiseEventOnFolderOpen()
args.Should().BeEquivalentTo(new ActiveSolutionChangedEventArgs(true, "name123"));
}

[TestMethod]
[DataRow(true)]
[DataRow(false)]
public void FolderWorkspaceInitializedEvent_RaiseEventOnProjectOpenedIfFolderWorkspace(bool isFolderWorkspace)
{
// Arrange
int counter = 0;
var testSubject = CreateTestSubject(isFolderWorkspace);
testSubject.FolderWorkspaceInitialized += (o, e) => { counter++; };

// Act
this.solutionMock.SimulateProjectOpen(null);

// Assert
counter.Should().Be(isFolderWorkspace ? 1 : 0);
}

private ActiveSolutionTracker CreateTestSubject(bool isFolderWorkspace = false)
{
var folderWorkspaceFolder = Substitute.For<IFolderWorkspaceService>();
folderWorkspaceFolder.IsFolderWorkspace().Returns(isFolderWorkspace);

return new ActiveSolutionTracker(serviceProvider, folderWorkspaceFolder, solutionInfoProvider);
}
}
65 changes: 0 additions & 65 deletions src/Integration/Helpers/AbsoluteFilePathLocator.cs

This file was deleted.

12 changes: 1 addition & 11 deletions src/Integration/MefServices/ActiveSolutionTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,18 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

using System;
using System.ComponentModel.Composition;
using System.Diagnostics;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using SonarLint.VisualStudio.Core;
using SonarLint.VisualStudio.Infrastructure.VS;
using ErrorHandler = Microsoft.VisualStudio.ErrorHandler;

namespace SonarLint.VisualStudio.Integration
{
[Export(typeof(IActiveSolutionTracker))]
[Export(typeof(IFolderWorkspaceMonitor))]
[PartCreationPolicy(CreationPolicy.Shared)]
internal sealed class ActiveSolutionTracker : IActiveSolutionTracker, IFolderWorkspaceMonitor, IVsSolutionEvents, IDisposable, IVsSolutionEvents7
internal sealed class ActiveSolutionTracker : IActiveSolutionTracker, IVsSolutionEvents, IDisposable, IVsSolutionEvents7
{
private readonly IFolderWorkspaceService folderWorkspaceService;
private readonly ISolutionInfoProvider solutionInfoProvider;
Expand All @@ -48,8 +44,6 @@ internal sealed class ActiveSolutionTracker : IActiveSolutionTracker, IFolderWor
/// </summary>
public event EventHandler<ActiveSolutionChangedEventArgs> ActiveSolutionChanged;

public event EventHandler FolderWorkspaceInitialized;

[ImportingConstructor]
public ActiveSolutionTracker([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, IFolderWorkspaceService folderWorkspaceService, ISolutionInfoProvider solutionInfoProvider)
{
Expand All @@ -63,10 +57,6 @@ public ActiveSolutionTracker([Import(typeof(SVsServiceProvider))] IServiceProvid
#region IVsSolutionEvents
int IVsSolutionEvents.OnAfterOpenProject(IVsHierarchy pHierarchy, int fAdded)
{
if (folderWorkspaceService.IsFolderWorkspace())
{
FolderWorkspaceInitialized?.Invoke(this, EventArgs.Empty);
}
return VSConstants.S_OK;
}

Expand Down
Loading