Ejemplo n.º 1
0
        internal TaggerProvider(ITableManagerProvider provider,
                                ITextDocumentFactoryService textDocumentFactoryService,
                                IContentTypeRegistryService contentTypeRegistryService,
                                IFileExtensionRegistryService fileExtensionRegistryService,
                                ISonarLintDaemon daemon,
                                [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
                                ISonarLintSettings settings,
                                ISonarLintOutput logger)
        {
            this.ErrorTableManager            = provider.GetTableManager(StandardTables.ErrorsTable);
            this.TextDocumentFactoryService   = textDocumentFactoryService;
            this.ContentTypeRegistryService   = contentTypeRegistryService;
            this.FileExtensionRegistryService = fileExtensionRegistryService;

            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.daemon   = daemon;
            this.dte      = (DTE)serviceProvider.GetService(typeof(DTE));
            this.settings = settings;
            this.logger   = logger;
        }
        public ActiveSolutionBoundTracker(IHost host, IActiveSolutionTracker activeSolutionTracker,
                                          ISonarLintOutput sonarLintOutput)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }
            if (activeSolutionTracker == null)
            {
                throw new ArgumentNullException(nameof(activeSolutionTracker));
            }
            if (sonarLintOutput == null)
            {
                throw new ArgumentNullException(nameof(sonarLintOutput));
            }

            this.extensionHost   = host;
            this.solutionTracker = activeSolutionTracker;
            this.sonarLintOutput = sonarLintOutput;

            this.solutionBindingInformationProvider = this.extensionHost.GetService <ISolutionBindingInformationProvider>();
            this.solutionBindingInformationProvider.AssertLocalServiceIsNotNull();

            this.errorListInfoBarController = this.extensionHost.GetService <IErrorListInfoBarController>();
            this.errorListInfoBarController.AssertLocalServiceIsNotNull();

            // The user changed the binding through the Team Explorer
            this.extensionHost.VisualStateManager.BindingStateChanged += this.OnBindingStateChanged;

            // The solution changed inside the IDE
            this.solutionTracker.ActiveSolutionChanged += this.OnActiveSolutionChanged;

            this.IsActiveSolutionBound = this.solutionBindingInformationProvider.IsSolutionBound();
            this.ProjectKey            = this.solutionBindingInformationProvider.GetProjectKey();
        }
Ejemplo n.º 3
0
 internal /* for testing */ SonarLintDaemon(ISonarLintSettings settings, ISonarLintOutput logger, string version, string storagePath, string tmpPath)
 {
     this.settings         = settings;
     this.logger           = logger;
     this.version          = version;
     this.tmpPath          = tmpPath;
     this.storagePath      = storagePath;
     this.workingDirectory = CreateTempDirectory();
 }
Ejemplo n.º 4
0
        public SonarQubeNotificationService(ISonarQubeService sonarQubeService, INotificationIndicatorViewModel model,
                                            ITimer timer, ISonarLintOutput sonarLintOutput)
        {
            this.sonarQubeService = sonarQubeService;
            this.timer            = timer;
            this.timer.Elapsed   += OnTimerElapsed;
            this.sonarLintOutput  = sonarLintOutput;

            Model = model;
        }
        public SuppressionManager(IServiceProvider serviceProvider, ITimerFactory timerFactory)
        {
            this.serviceProvider = serviceProvider;
            this.timerFactory    = timerFactory;

            this.activeSolutionBoundTracker = serviceProvider.GetMefService <IActiveSolutionBoundTracker>();
            this.activeSolutionBoundTracker.SolutionBindingChanged += OnSolutionBindingChanged;

            this.sonarQubeService = serviceProvider.GetMefService <ISonarQubeService>();
            this.sonarLintOutput  = serviceProvider.GetMefService <ISonarLintOutput>();

            RefreshSuppresionHandling();
        }
Ejemplo n.º 6
0
 public static string TryGetConfig(ISonarLintOutput logger, EnvDTE.ProjectItem projectItem, string absoluteFilePath, out string sqLanguage)
 {
     try
     {
         return(FileConfig.TryGet(projectItem, absoluteFilePath).ToJson(absoluteFilePath, out sqLanguage));
     }
     catch (Exception e)
     {
         logger.Write("Unable to collect C/C++ configuration: " + e.ToString());
         sqLanguage = null;
         return(null);
     }
 }
Ejemplo n.º 7
0
        public DeprecationManager(IInfoBarManager infoBarManager, ISonarLintOutput sonarLintOutput)
        {
            if (infoBarManager == null)
            {
                throw new ArgumentNullException(nameof(infoBarManager));
            }
            if (sonarLintOutput == null)
            {
                throw new ArgumentNullException(nameof(sonarLintOutput));
            }

            this.infoBarManager  = infoBarManager;
            this.sonarLintOutput = sonarLintOutput;
        }
        public SuppressionManager(IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            this.serviceProvider = serviceProvider;

            this.activeSolutionBoundTracker = serviceProvider.GetMefService <IActiveSolutionBoundTracker>();
            this.activeSolutionBoundTracker.SolutionBindingChanged += OnSolutionBindingChanged;

            this.sonarLintOutput = serviceProvider.GetMefService <ISonarLintOutput>();

            RefreshSuppresionHandling();
        }
Ejemplo n.º 9
0
        protected override void Initialize()
        {
            AddOptionKey(NotificationDataKey);
            base.Initialize();

            var sonarqubeService = this.GetMefService <ISonarQubeService>();

            sonarLintOutput = this.GetMefService <ISonarLintOutput>();

            notifications = new SonarQubeNotificationService(sonarqubeService,
                                                             new NotificationIndicatorViewModel(), new TimerWrapper {
                Interval = 60000
            }, sonarLintOutput);

            notificationIcon.DataContext = notifications.Model;

            activeSolutionBoundTracker = this.GetMefService <IActiveSolutionBoundTracker>();
            activeSolutionBoundTracker.SolutionBindingChanged += OnSolutionBindingChanged;
        }
Ejemplo n.º 10
0
        public DelegateInjector(Func <SyntaxTree, Diagnostic, bool> suppressionFunction, ISonarLintOutput sonarLintOutput)
        {
            if (suppressionFunction == null)
            {
                throw new ArgumentNullException(nameof(suppressionFunction));
            }
            if (sonarLintOutput == null)
            {
                throw new ArgumentNullException(nameof(sonarLintOutput));
            }

            this.suppressionFunction = suppressionFunction;
            this.sonarLintOutput     = sonarLintOutput;
            // Inject the delegate into any Sonar analyzer assemblies that are already loaded
            foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
            {
                InjectSuppressionDelegate(asm);
            }

            // Monitor assemblies as they are loaded and inject the delegate if necessary
            AppDomain.CurrentDomain.AssemblyLoad += OnAssemblyLoad;
        }
Ejemplo n.º 11
0
 public SonarLintDaemon(ISonarLintSettings settings, ISonarLintOutput logger)
     : this(settings, logger, daemonVersion, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Path.GetTempPath())
 {
 }