Beispiel #1
0
        internal TaggerProvider(ISonarErrorListDataSource sonarErrorDataSource,
                                ITextDocumentFactoryService textDocumentFactoryService,
                                IIssuesFilter issuesFilter,
                                IAnalyzerController analyzerController,
                                [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
                                ISonarLanguageRecognizer languageRecognizer,
                                IAnalysisRequester analysisRequester,
                                IAnalysisIssueVisualizationConverter converter,
                                ILogger logger,
                                IScheduler scheduler)
        {
            this.sonarErrorDataSource       = sonarErrorDataSource;
            this.textDocumentFactoryService = textDocumentFactoryService;
            this.issuesFilter = issuesFilter;

            this.analyzerController = analyzerController;
            this.dte = serviceProvider.GetService <DTE>();
            this.languageRecognizer = languageRecognizer;
            this.converter          = converter;
            this.logger             = logger;
            this.scheduler          = scheduler;

            vsStatusBar = serviceProvider.GetService(typeof(IVsStatusbar)) as IVsStatusbar;
            analysisRequester.AnalysisRequested += OnAnalysisRequested;

            vsSolution = serviceProvider.GetService(typeof(SVsSolution)) as IVsSolution5;
        }
Beispiel #2
0
        internal TaggerProvider(ITableManagerProvider tableManagerProvider,
                                ITextDocumentFactoryService textDocumentFactoryService,
                                IIssuesFilter issuesFilter,
                                IAnalyzerController analyzerController,
                                [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
                                ISonarLanguageRecognizer languageRecognizer,
                                IAnalysisRequester analysisRequester,
                                ILogger logger,
                                IScheduler scheduler)
        {
            this.errorTableManager          = tableManagerProvider.GetTableManager(StandardTables.ErrorsTable);
            this.textDocumentFactoryService = textDocumentFactoryService;
            this.issuesFilter = issuesFilter;

            this.errorTableManager.AddSource(this, StandardTableColumnDefinitions.DetailsExpander,
                                             StandardTableColumnDefinitions.ErrorSeverity, StandardTableColumnDefinitions.ErrorCode,
                                             StandardTableColumnDefinitions.ErrorSource, StandardTableColumnDefinitions.BuildTool,
                                             StandardTableColumnDefinitions.ErrorSource, StandardTableColumnDefinitions.ErrorCategory,
                                             StandardTableColumnDefinitions.Text, StandardTableColumnDefinitions.DocumentName,
                                             StandardTableColumnDefinitions.Line, StandardTableColumnDefinitions.Column,
                                             StandardTableColumnDefinitions.ProjectName);

            this.analyzerController = analyzerController;
            this.dte = serviceProvider.GetService <DTE>();
            this.languageRecognizer = languageRecognizer;
            this.logger             = logger;
            this.scheduler          = scheduler;

            vsStatusBar = serviceProvider.GetService(typeof(IVsStatusbar)) as IVsStatusbar;
            analysisRequester.AnalysisRequested += OnAnalysisRequested;
        }
        public AnalysisConfigMonitor(IAnalysisRequester analysisRequester,
                                     IUserSettingsProvider userSettingsProvider,             // reports changes to user settings.json
                                     IActiveSolutionBoundTracker activeSolutionBoundTracker, // reports changes to connected mode
                                     ILogger logger)
        {
            this.analysisRequester          = analysisRequester;
            this.userSettingsProvider       = userSettingsProvider;
            this.activeSolutionBoundTracker = activeSolutionBoundTracker;
            this.logger = logger;

            userSettingsProvider.SettingsChanged += OnUserSettingsChanged;
            activeSolutionBoundTracker.SolutionBindingChanged += OnSolutionBindingChanged;
            activeSolutionBoundTracker.SolutionBindingUpdated += OnSolutionBindingUpdated;
        }
Beispiel #4
0
        public AnalysisConfigMonitor(IAnalysisRequester analysisRequester,
                                     IUserSettingsProvider userSettingsProvider,             // reports changes to user settings.json
                                     IActiveSolutionBoundTracker activeSolutionBoundTracker, // reports changes to connected mode
                                     ISuppressedIssuesMonitor suppressedIssuesMonitor,
                                     ILogger logger)
        {
            this.analysisRequester          = analysisRequester;
            this.userSettingsProvider       = userSettingsProvider;
            this.activeSolutionBoundTracker = activeSolutionBoundTracker;
            this.suppressedIssuesMonitor    = suppressedIssuesMonitor;
            this.logger = logger;

            userSettingsProvider.SettingsChanged += OnUserSettingsChanged;
            suppressedIssuesMonitor.SuppressionsUpdateRequested += OnSuppressionsUpdated;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DisableRuleCommand"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        /// <param name="menuCommandService">Command service to add command to, not null.</param>
        internal /* for testing */ CFamilyReproducerCommand(IMenuCommandService menuCommandService,
                                                            IActiveDocumentLocator activeDocumentLocator, ISonarLanguageRecognizer languageRecognizer,
                                                            IAnalysisRequester analysisRequester, ILogger logger)
        {
            if (menuCommandService == null)
            {
                throw new ArgumentNullException(nameof(menuCommandService));
            }

            this.activeDocumentLocator   = activeDocumentLocator ?? throw new ArgumentNullException(nameof(activeDocumentLocator));
            this.sonarLanguageRecognizer = languageRecognizer ?? throw new ArgumentNullException(nameof(languageRecognizer));
            this.analysisRequester       = analysisRequester ?? throw new ArgumentNullException(nameof(analysisRequester));
            this.logger = logger ?? throw new ArgumentNullException(nameof(logger));

            var menuCommandID = new CommandID(CommandSet, CommandId);

            menuItem = new OleMenuCommand(Execute, null, QueryStatus, menuCommandID);
            menuCommandService.AddCommand(menuItem);
        }
        private static MenuCommand CreateCFamilyReproducerCommand(IActiveDocumentLocator documentLocator,
                                                                  ISonarLanguageRecognizer languageRecognizer, IAnalysisRequester analysisRequester, ILogger logger)
        {
            var dummyMenuService = new DummyMenuCommandService();

            new CFamilyReproducerCommand(dummyMenuService, documentLocator, languageRecognizer, analysisRequester, logger);

            dummyMenuService.AddedMenuCommands.Count.Should().Be(1);
            return(dummyMenuService.AddedMenuCommands[0]);
        }
 public static void RequestAnalysis(this IAnalysisRequester analysisRequester, params string[] filePaths)
 => analysisRequester.RequestAnalysis(null, filePaths);