From 0e8d8020f3d551db6a2199033567ed47cb1cf1b3 Mon Sep 17 00:00:00 2001 From: Stefan Kert Date: Sat, 6 Apr 2019 08:42:59 +0200 Subject: [PATCH] Only navigate on errorlevel Error --- src/BuildVision/Helpers/ProjectExtensions.cs | 13 ++------- .../Services/BuildInformationProvider.cs | 29 ++++++++++++------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/BuildVision/Helpers/ProjectExtensions.cs b/src/BuildVision/Helpers/ProjectExtensions.cs index 045f6af8..703ac904 100644 --- a/src/BuildVision/Helpers/ProjectExtensions.cs +++ b/src/BuildVision/Helpers/ProjectExtensions.cs @@ -249,8 +249,7 @@ public static string GetProjectTypeGuids(this Project proj) var service = SolutionProjectsExtensions.GetService(proj.DTE, typeof(IVsSolution)); var solution = (IVsSolution)service; - IVsHierarchy hierarchy; - int result = solution.GetProjectOfUniqueName(proj.UniqueName, out hierarchy); + int result = solution.GetProjectOfUniqueName(proj.UniqueName, out var hierarchy); if (!string.IsNullOrEmpty(proj.Kind)) { @@ -372,7 +371,7 @@ public static string GetOutputType(this Project project) } } } - catch(ArgumentException) + catch (ArgumentException) { // We are catching this seperatly because in the current VS2017 Version // there is a bug that makes it impossible for us to retrieve the extenders @@ -449,7 +448,7 @@ private static string GetProjectTypeFromRegistry(string projectKind, string vers } TraceManager.Trace( - string.Format("Project type is taken from the registry: Kind={0}, DTEVersion={1}, Type={2}", projectKind, version, type), + string.Format("Project type is taken from the registry: Kind={0}, DTEVersion={1}, Type={2}", projectKind, version, type), EventLogEntryType.Warning); if (string.IsNullOrWhiteSpace(type)) @@ -618,11 +617,5 @@ public static bool IsProjectHidden(string projectFileName) return true; } } - - public static Microsoft.Build.Evaluation.Project GetMsBuildProject(this Project project) - { - var root = Microsoft.Build.Construction.ProjectRootElement.Open(project.FullName); - return new Microsoft.Build.Evaluation.Project(root); - } } } diff --git a/src/BuildVision/Services/BuildInformationProvider.cs b/src/BuildVision/Services/BuildInformationProvider.cs index b40df8ce..2b74543a 100644 --- a/src/BuildVision/Services/BuildInformationProvider.cs +++ b/src/BuildVision/Services/BuildInformationProvider.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel.Composition; using System.Diagnostics; @@ -15,18 +14,15 @@ using BuildVision.Helpers; using BuildVision.Services; using BuildVision.Tool.Building; -using BuildVision.Tool.Models; using BuildVision.UI; using BuildVision.UI.Common.Logging; using BuildVision.UI.Contracts; -using BuildVision.UI.Helpers; using BuildVision.UI.Models; using BuildVision.Views.Settings; using EnvDTE; using EnvDTE80; using Microsoft.Build.Framework; using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; using ErrorItem = BuildVision.Contracts.ErrorItem; namespace BuildVision.Core @@ -44,11 +40,11 @@ public class BuildInformationProvider : IBuildInformationProvider private readonly ISolutionProvider _solutionProvider; private readonly IBuildService _buildService; private readonly ITaskBarInfoService _taskBarInfoService; - private ObservableCollection _projects; + private readonly ObservableCollection _projects; - private BuildInformationModel _buildInformationModel; - private BuildEvents _buildEvents; - private DTE2 _dte; + private readonly BuildInformationModel _buildInformationModel; + private readonly BuildEvents _buildEvents; + private readonly DTE2 _dte; private string _origTextCurrentState; private const int BuildInProcessCountOfQuantumSleep = 5; @@ -87,9 +83,15 @@ public BuildInformationProvider( _buildOutputLogger.OnErrorRaised += BuildOutputLogger_OnErrorRaised; } - public IBuildInformationModel GetBuildInformationModel() => _buildInformationModel; + public IBuildInformationModel GetBuildInformationModel() + { + return _buildInformationModel; + } - public ObservableCollection GetBuildingProjects() => _projects; + public ObservableCollection GetBuildingProjects() + { + return _projects; + } public void ReloadCurrentProjects() { @@ -167,7 +169,7 @@ private void BuildOutputLogger_OnErrorRaised(BuildProjectContextEntry projectEnt } bool navigateToBuildFailure = (args.ErrorLevel == ErrorLevel.Error && _packageSettingsProvider.Settings.GeneralSettings.NavigateToBuildFailureReason == NavigateToBuildFailureReasonCondition.OnErrorRaised); - if (_packageSettingsProvider.Settings.GeneralSettings.NavigateToBuildFailureReason == NavigateToBuildFailureReasonCondition.OnErrorRaised && !ErrorNavigationService.BuildErrorNavigated) + if (navigateToBuildFailure && !ErrorNavigationService.BuildErrorNavigated) { _errorNavigationService.NavigateToErrorItem(errorItem); } @@ -443,7 +445,9 @@ public void BuildFinished(bool success, bool canceled) foreach (var projectItem in _projects) { if (projectItem.State == ProjectState.Pending) + { projectItem.State = ProjectState.Skipped; + } } } @@ -489,7 +493,10 @@ public void BuildFinished(bool success, bool canceled) foreach (var project in _projects) { if (ErrorNavigationService.BuildErrorNavigated) + { break; + } + foreach (var error in project.Errors) { if (ErrorNavigationService.BuildErrorNavigated)