Skip to content

Commit

Permalink
SLVS-1620 Remove unused AbsoluteFilePathLocator & IFolderWorkspaceMon…
Browse files Browse the repository at this point in the history
…itor (#5937)
  • Loading branch information
georgii-borovinskikh-sonarsource authored Jan 8, 2025
1 parent 8ae61c2 commit 89f69c2
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 318 deletions.
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

0 comments on commit 89f69c2

Please sign in to comment.