Skip to content

Conversation

@CyrusNajmabadi
Copy link
Member

No description provided.

@ghost ghost added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 8, 2025
public override async Task<ImmutableArray<Diagnostic>> AnalyzeSyntaxAsync(TextDocument textDocument, SyntaxTree? tree, CancellationToken cancellationToken)
=> XamlProjectService.AnalyzerService is null || textDocument is not Document document
? []
: await XamlProjectService.AnalyzerService.AnalyzeSyntaxAsync(document, cancellationToken).ConfigureAwait(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await

Does this need to be awaited?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. because on different paths we return different values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making sure we're thinking of the same change:

    public override Task<ImmutableArray<Diagnostic>> AnalyzeSyntaxAsync(TextDocument textDocument, SyntaxTree? tree, CancellationToken cancellationToken)
        => XamlProjectService.AnalyzerService is null || textDocument is not Document document
            ? SpecializedTasks.EmptyImmutableArray<Diagnostic>()
            : XamlProjectService.AnalyzerService.AnalyzeSyntaxAsync(document, cancellationToken);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CyrusNajmabadi -- not a deal breaker, just curious why the suggested code wouldn't work

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would work... Or just the code already there :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not huge on avoiding async/await personally.

=> SpecializedTasks.EmptyImmutableArray<Diagnostic>();

public override Task<ImmutableArray<Diagnostic>> AnalyzeSyntaxAsync(Document document, CancellationToken cancellationToken)
public override Task<ImmutableArray<Diagnostic>> AnalyzeSyntaxAsync(TextDocument document, SyntaxTree? tree, CancellationToken cancellationToken)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TextDocument

no need to check for it being a Document?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. This is just text code

@CyrusNajmabadi CyrusNajmabadi requested a review from ToddGrun April 8, 2025 23:29
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review April 8, 2025 23:29
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner April 8, 2025 23:29
@CyrusNajmabadi CyrusNajmabadi enabled auto-merge April 8, 2025 23:29
@CyrusNajmabadi
Copy link
Member Author

@ToddGrun ptal.

@CyrusNajmabadi CyrusNajmabadi merged commit a9d7449 into dotnet:main Apr 9, 2025
25 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the simplifyAnalyzer branch April 9, 2025 01:21
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Apr 9, 2025
@RikkiGibson RikkiGibson modified the milestones: Next, 18.0 P1 Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead VSCode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants