diff --git a/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs b/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs index 43e79fa30036a3fc27d7cde694fb9c96fa85c2f4..91368de37b05d0e2afaa1f85398b884abdc86a9f 100644 --- a/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs +++ b/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs @@ -391,8 +391,23 @@ private ErrorRank GetErrorRank(DiagnosticData item) switch (value) { case WellKnownDiagnosticTags.Build: - // any error from build is highest priority - return ErrorRank.Lexical; + // any error from build gets lowest priority + // see https://github.com/dotnet/roslyn/issues/28807 + // + // this is only used when intellisense (live) errors are involved. + // with "build only" filter on, we use order of errors came in from build for ordering + // and doesn't use ErrorRank for ordering (by giving same rank for all errors) + // + // when live errors are involved, by default, error list will use the following to sort errors + // error rank > project rank > project name > file name > line > column + // which will basically make syntax errors show up before declaration error and method body semantic errors + // among same type of errors, leaf project's error will show up first and then projects that depends on the leaf projects + // + // any build errors mixed with live errors will show up at the end. when live errors are on, some of errors + // still left as build errors such as errors produced after CompilationStages.Compile or ones listed here + // http://source.roslyn.io/#Microsoft.CodeAnalysis.CSharp/Compilation/CSharpCompilerDiagnosticAnalyzer.cs,23 or similar ones for VB + // and etc. + return ErrorRank.PostBuild; case nameof(ErrorRank.Lexical): return ErrorRank.Lexical; case nameof(ErrorRank.Syntactic):