Skip to content

Commit

Permalink
Fix SC warning
Browse files Browse the repository at this point in the history
  • Loading branch information
rita-gorokhod committed Sep 23, 2022
1 parent a9bd1da commit 6c4e541
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
using Moq;
using SonarLint.VisualStudio.Core;
using SonarLint.VisualStudio.Core.Analysis;
using SonarLint.VisualStudio.Core.Suppression;
using SonarLint.VisualStudio.Integration.Vsix;
using SonarLint.VisualStudio.Integration.Vsix.Analysis;
using SonarLint.VisualStudio.Integration.Vsix.ErrorList;
Expand Down Expand Up @@ -114,7 +113,7 @@ public void SetUp()
.Returns(Mock.Of<IIssueConsumer>());

this.provider = new TaggerProvider(mockSonarErrorDataSource.Object, dummyDocumentFactoryService, mockAnalyzerController.Object, serviceProvider,
mockSonarLanguageRecognizer.Object, mockAnalysisRequester.Object, mockTaggableBufferIndicator.Object, issueConsumerFactory.Object, logger, mockAnalysisScheduler.Object);
mockSonarLanguageRecognizer.Object, mockAnalysisRequester.Object, mockTaggableBufferIndicator.Object, issueConsumerFactory.Object, logger, mockAnalysisScheduler.Object, new NoOpThreadHandler());
}

[TestMethod]
Expand All @@ -126,6 +125,7 @@ public void CreateTagger_should_create_tracker_when_analysis_is_supported()
tagger.Should().NotBeNull();

VerifyCheckedAnalysisIsSupported();
VerifyAnalysisWasRequested();
mockAnalyzerController.VerifyNoOtherCalls();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ private TaggerProvider CreateTaggerProvider()
.Callback((string file, Action<CancellationToken> analyze, int timeout) => analyze(CancellationToken.None));

var provider = new TaggerProvider(mockSonarErrorDataSource.Object, textDocFactoryServiceMock.Object, mockAnalyzerController.Object,
serviceProvider, languageRecognizer, mockAnalysisRequester.Object, Mock.Of<ITaggableBufferIndicator>(), Mock.Of<IIssueConsumerFactory>(), logger, mockAnalysisScheduler.Object);
serviceProvider, languageRecognizer, mockAnalysisRequester.Object, Mock.Of<ITaggableBufferIndicator>(), Mock.Of<IIssueConsumerFactory>(), logger, mockAnalysisScheduler.Object, new NoOpThreadHandler());
return provider;
}

Expand Down
15 changes: 13 additions & 2 deletions src/Integration.Vsix/SonarLintTagger/TaggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ internal sealed class TaggerProvider : ITaggerProvider
private readonly IScheduler scheduler;
private readonly IVsSolution5 vsSolution;
private readonly IIssueConsumerFactory issueConsumerFactory;
private readonly IThreadHandling threadHandling;

[ImportingConstructor]
internal TaggerProvider(ISonarErrorListDataSource sonarErrorDataSource,
Expand All @@ -81,7 +82,8 @@ internal TaggerProvider(ISonarErrorListDataSource sonarErrorDataSource,
ITaggableBufferIndicator taggableBufferIndicator,
IIssueConsumerFactory issueConsumerFactory,
ILogger logger,
IScheduler scheduler)
IScheduler scheduler,
IThreadHandling threadHandling)
{
this.sonarErrorDataSource = sonarErrorDataSource;
this.textDocumentFactoryService = textDocumentFactoryService;
Expand All @@ -93,6 +95,7 @@ internal TaggerProvider(ISonarErrorListDataSource sonarErrorDataSource,
this.issueConsumerFactory = issueConsumerFactory;
this.logger = logger;
this.scheduler = scheduler;
this.threadHandling = threadHandling;

vsStatusBar = serviceProvider.GetService(typeof(IVsStatusbar)) as IVsStatusbar;
analysisRequester.AnalysisRequested += OnAnalysisRequested;
Expand Down Expand Up @@ -182,7 +185,15 @@ public ITagger<T> CreateTagger<T>(ITextBuffer buffer) where T : ITag
}

private TextBufferIssueTracker InternalCreateTextBufferIssueTracker(ITextDocument textDocument, IEnumerable<AnalysisLanguage> analysisLanguages) =>
new TextBufferIssueTracker(dte, this, textDocument, analysisLanguages, sonarErrorDataSource, vsSolution, issueConsumerFactory, logger);
new TextBufferIssueTracker(dte,
this,
textDocument,
analysisLanguages,
sonarErrorDataSource,
vsSolution,
issueConsumerFactory,
logger,
threadHandling);

#endregion IViewTaggerProvider members

Expand Down
13 changes: 0 additions & 13 deletions src/Integration.Vsix/SonarLintTagger/TextBufferIssueTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
using Microsoft.VisualStudio.Threading;
using SonarLint.VisualStudio.Core;
using SonarLint.VisualStudio.Core.Analysis;
using SonarLint.VisualStudio.Infrastructure.VS;
using SonarLint.VisualStudio.Integration.Helpers;
using SonarLint.VisualStudio.Integration.Vsix.Analysis;
using SonarLint.VisualStudio.Integration.Vsix.ErrorList;
Expand Down Expand Up @@ -68,18 +67,6 @@ internal sealed class TextBufferIssueTracker : IIssueTracker, ITagger<IErrorTag>
internal /* for testing */ IssuesSnapshotFactory Factory { get; }

public TextBufferIssueTracker(DTE2 dte,
TaggerProvider provider,
ITextDocument document,
IEnumerable<AnalysisLanguage> detectedLanguages,
ISonarErrorListDataSource sonarErrorDataSource,
IVsSolution5 vsSolution,
IIssueConsumerFactory issueConsumerFactory,
ILogger logger)
: this(dte, provider, document, detectedLanguages, sonarErrorDataSource,
vsSolution, issueConsumerFactory, logger, new ThreadHandling())
{ }

internal /* for testing */ TextBufferIssueTracker(DTE2 dte,
TaggerProvider provider,
ITextDocument document,
IEnumerable<AnalysisLanguage> detectedLanguages,
Expand Down

0 comments on commit 6c4e541

Please sign in to comment.