Skip to content

Commit

Permalink
Only navigate on errorlevel Error
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKert committed Apr 6, 2019
1 parent 0b6022e commit 0e8d802
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
13 changes: 3 additions & 10 deletions src/BuildVision/Helpers/ProjectExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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);
}
}
}
29 changes: 18 additions & 11 deletions src/BuildVision/Services/BuildInformationProvider.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.Diagnostics;
Expand All @@ -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
Expand All @@ -44,11 +40,11 @@ public class BuildInformationProvider : IBuildInformationProvider
private readonly ISolutionProvider _solutionProvider;
private readonly IBuildService _buildService;
private readonly ITaskBarInfoService _taskBarInfoService;
private ObservableCollection<IProjectItem> _projects;
private readonly ObservableCollection<IProjectItem> _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;
Expand Down Expand Up @@ -87,9 +83,15 @@ public BuildInformationProvider(
_buildOutputLogger.OnErrorRaised += BuildOutputLogger_OnErrorRaised;
}

public IBuildInformationModel GetBuildInformationModel() => _buildInformationModel;
public IBuildInformationModel GetBuildInformationModel()
{
return _buildInformationModel;
}

public ObservableCollection<IProjectItem> GetBuildingProjects() => _projects;
public ObservableCollection<IProjectItem> GetBuildingProjects()
{
return _projects;
}

public void ReloadCurrentProjects()
{
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
}
}

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0e8d802

Please sign in to comment.