-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Further improvement for several entities. Starting to move to IVsUpda…
…teSolutionEvents
- Loading branch information
1 parent
3a680f8
commit 0b1f15d
Showing
8 changed files
with
298 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,127 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using Microsoft.Build.Framework; | ||
|
||
namespace BuildVision.Contracts | ||
{ | ||
public class ErrorItem | ||
{ | ||
public const string DefaultSortPropertyName = "Number"; | ||
private readonly List<string> _invalidFileNames = new List<string> { "CSC", "MSBUILD", "LINK" }; | ||
public class ErrorItem | ||
{ | ||
public const string DefaultSortPropertyName = "Number"; | ||
private readonly List<string> _invalidFileNames = new List<string> { "CSC", "MSBUILD", "LINK" }; | ||
|
||
public bool CanNavigateTo { get; set; } | ||
public bool CanNavigateTo { get; set; } | ||
|
||
public int? Number { get; set; } | ||
public int? Number { get; set; } | ||
|
||
public ErrorLevel Level { get; set; } | ||
public ErrorLevel Level { get; set; } | ||
|
||
public string Code { get; set; } | ||
public string Code { get; set; } | ||
|
||
public string File { get; set; } | ||
public string File { get; set; } | ||
|
||
public string FileName | ||
{ | ||
get | ||
{ | ||
try | ||
{ | ||
return Path.GetFileName(File); | ||
} | ||
catch (ArgumentException) | ||
public string FileName | ||
{ | ||
return File; | ||
get | ||
{ | ||
try | ||
{ | ||
return Path.GetFileName(File); | ||
} | ||
catch (ArgumentException) | ||
{ | ||
return File; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
public string ProjectFile { get; set; } | ||
public string ProjectFile { get; set; } | ||
|
||
public int LineNumber { get; set; } | ||
public int ColumnNumber { get; set; } | ||
public int LineNumber { get; set; } | ||
public int ColumnNumber { get; set; } | ||
|
||
public int EndLineNumber { get; set; } | ||
public int EndLineNumber { get; set; } | ||
|
||
public int EndColumnNumber { get; set; } | ||
public int EndColumnNumber { get; set; } | ||
|
||
public string Subcategory { get; set; } | ||
public string Subcategory { get; set; } | ||
|
||
public string Message { get; set; } | ||
public string Message { get; set; } | ||
|
||
public Action GoToError { get; } | ||
public Action GoToError { get; } | ||
|
||
public ErrorItem(ErrorLevel errorLevel, Action<ErrorItem> goToError) | ||
{ | ||
Level = errorLevel; | ||
GoToError = () => goToError(this); | ||
} | ||
public ErrorItem(ErrorLevel errorLevel, Action<ErrorItem> goToError) | ||
{ | ||
Level = errorLevel; | ||
GoToError = () => goToError(this); | ||
} | ||
|
||
public ErrorItem() { } | ||
public ErrorItem() { } | ||
|
||
// 1. EnvDTE.TextSelection.MoveToLineAndOffset requires line and offset numbers beginning at one. | ||
// BuildErrorEventArgs.LineNumber and BuildErrorEventArgs.ColumnNumber may be uninitialized. | ||
// 2. BuildErrorEventArgs.EndLineNumber and BuildErrorEventArgs.EndColumnNumber may be uninitialized, | ||
// regardless of BuildErrorEventArgs.LineNumber and BuildErrorEventArgs.ColumnNumber. | ||
public void VerifyValues() | ||
{ | ||
if (_invalidFileNames.Contains(File) && LineNumber == 0 && ColumnNumber == 0) | ||
{ | ||
CanNavigateTo = false; | ||
return; | ||
} | ||
|
||
if (LineNumber < 1) | ||
LineNumber = 1; | ||
public void Init(BuildErrorEventArgs e) | ||
{ | ||
Code = e.Code; | ||
File = e.File; | ||
ProjectFile = e.ProjectFile; | ||
LineNumber = e.LineNumber; | ||
ColumnNumber = e.ColumnNumber; | ||
EndLineNumber = e.EndLineNumber; | ||
EndColumnNumber = e.EndColumnNumber; | ||
Subcategory = e.Subcategory; | ||
Message = e.Message; | ||
} | ||
|
||
public void Init(BuildWarningEventArgs e) | ||
{ | ||
Code = e.Code; | ||
File = e.File; | ||
ProjectFile = e.ProjectFile; | ||
LineNumber = e.LineNumber; | ||
ColumnNumber = e.ColumnNumber; | ||
EndLineNumber = e.EndLineNumber; | ||
EndColumnNumber = e.EndColumnNumber; | ||
Subcategory = e.Subcategory; | ||
Message = e.Message; | ||
} | ||
|
||
public void Init(BuildMessageEventArgs e) | ||
{ | ||
Code = e.Code; | ||
File = e.File; | ||
ProjectFile = e.ProjectFile; | ||
LineNumber = e.LineNumber; | ||
ColumnNumber = e.ColumnNumber; | ||
EndLineNumber = e.EndLineNumber; | ||
EndColumnNumber = e.EndColumnNumber; | ||
Subcategory = e.Subcategory; | ||
Message = e.Message; | ||
} | ||
// 1. EnvDTE.TextSelection.MoveToLineAndOffset requires line and offset numbers beginning at one. | ||
// BuildErrorEventArgs.LineNumber and BuildErrorEventArgs.ColumnNumber may be uninitialized. | ||
// 2. BuildErrorEventArgs.EndLineNumber and BuildErrorEventArgs.EndColumnNumber may be uninitialized, | ||
// regardless of BuildErrorEventArgs.LineNumber and BuildErrorEventArgs.ColumnNumber. | ||
public void VerifyValues() | ||
{ | ||
if (_invalidFileNames.Contains(File) && LineNumber == 0 && ColumnNumber == 0) | ||
{ | ||
CanNavigateTo = false; | ||
return; | ||
} | ||
|
||
if (ColumnNumber < 1) | ||
ColumnNumber = 1; | ||
if (LineNumber < 1) | ||
LineNumber = 1; | ||
|
||
if (EndLineNumber == 0 && EndColumnNumber == 0) | ||
{ | ||
EndLineNumber = LineNumber; | ||
EndColumnNumber = ColumnNumber; | ||
} | ||
if (ColumnNumber < 1) | ||
ColumnNumber = 1; | ||
|
||
CanNavigateTo = true; | ||
if (EndLineNumber == 0 && EndColumnNumber == 0) | ||
{ | ||
EndLineNumber = LineNumber; | ||
EndColumnNumber = ColumnNumber; | ||
} | ||
|
||
CanNavigateTo = true; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.