-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report external build errors using the platform's diagnostic brokered #73477
Report external build errors using the platform's diagnostic brokered #73477
Conversation
9c076e0
to
9972d99
Compare
_externalErrorReporter = new ProjectExternalErrorReporter(ProjectSystemProject.Id, externalErrorReportingPrefix, language, workspaceImpl); | ||
var projectHierarchyGuid = GetProjectIDGuid(hierarchy); | ||
|
||
_externalErrorReporter = new ProjectExternalErrorReporter(ProjectSystemProject.Id, projectHierarchyGuid, externalErrorReportingPrefix, language, workspaceImpl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hierarchy guid is required for the current project filter to work in the error list.
9972d99
to
4f67c89
Compare
{ | ||
using var _ = CodeAnalysis.PooledObjects.ArrayBuilder<DiagnosticData>.GetInstance(out var builder); | ||
|
||
var buildDiagnostics = _buildErrorDiagnosticService.GetBuildErrors().Where(d => d.ProjectId != null && d.Severity != DiagnosticSeverity.Hidden); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This never returned diagnostics with LSP on (and cannot). per convo with @CyrusNajmabadi removing this is fine.
4f67c89
to
e40e2d4
Compare
|
||
namespace Microsoft.CodeAnalysis.Diagnostics; | ||
|
||
[ExportWorkspaceServiceFactory(typeof(IBuildOnlyDiagnosticsService), ServiceLayer.Default), Shared] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead - does not return build only diagnostic with LSP pull
@@ -116,9 +116,6 @@ internal partial class CodeFixService : ICodeFixService | |||
var copilotDiagnostics = await GetCopilotDiagnosticsAsync(document, range, priorityProvider.Priority, cancellationToken).ConfigureAwait(false); | |||
allDiagnostics = allDiagnostics.AddRange(copilotDiagnostics); | |||
|
|||
var buildOnlyDiagnosticsService = document.Project.Solution.Services.GetRequiredService<IBuildOnlyDiagnosticsService>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead - this would always get an empty set with LSP pull.
...ols/ExternalAccess/FSharp/Internal/VisualStudio/FSharpProjectExternalErrorReporterFactory.cs
Outdated
Show resolved
Hide resolved
@@ -219,7 +169,7 @@ void computeDiagnosticsToFix(IUIThreadOperationContext context) | |||
// snapshots. Otherwise, get all diagnostics from the diagnostic service. | |||
var diagnosticsToFixTask = selectedEntriesOnly | |||
? _suppressionStateService.GetSelectedItemsAsync(isAddSuppression, cancellationToken) | |||
: GetAllBuildDiagnosticsAsync(shouldFixInProject, cancellationToken); | |||
: Task.FromResult<ImmutableArray<DiagnosticData>>([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't feel comfortable removing a ton more things here for servicing. can re-evaluate in main how much (if any) of this type is needed.
src/VisualStudio/Core/Def/TaskList/ProjectExternalErrorReporter.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs
Show resolved
Hide resolved
/// </summary> | ||
[Export(typeof(ExternalErrorDiagnosticUpdateSource))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meat of the change in this type. The change here is to report build diagnostics to the editor's diagnostic brokered service. Without this, the build diagnostics reported here go into the void. THis was fine for CPS projects because they are responsible for reporting build errors to the service.
However legacy csproj project system was not updated to do the same, so build diagnostics for legacy csproj went into the void.
This changes our reporter to instead report the build diagnostics to the brokered service. Long term legacy csproj should be updated to use the brokered service themselves, but requires additional work to enable brokered service usage in C++.
src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs
Show resolved
Hide resolved
src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs
Show resolved
Hide resolved
src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs
Show resolved
Hide resolved
service instead of via Roslyn
e40e2d4
to
8133b7e
Compare
src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs
Show resolved
Hide resolved
src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs
Show resolved
Hide resolved
b6bb1fd
to
343a47d
Compare
service instead of via Roslyn
Looks like
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2032334