Skip to content

Conversation

@CyrusNajmabadi
Copy link
Member

Fixes #63404

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner November 30, 2024 02:02
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 30, 2024
if (modifiers.Any())
return (modifiers.Add(s_asyncKeywordWithSpace), returnType);
{
// 'partial' modifier must say at the end of the modifiers arrays.
Copy link
Member

Choose a reason for hiding this comment

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

I think await completion that I implemented may have the exact same bug. The bug is more critical for IntelliSense I think.

Copy link
Member

Choose a reason for hiding this comment

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

protected override int GetAsyncKeywordInsertionPosition(SyntaxNode declaration)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @Youssef1313 . I'm going to handle in a followup pr.

return (modifiers.Add(s_asyncKeywordWithSpace), returnType);
{
// 'partial' modifier must say at the end of the modifiers arrays.
var partialModifier = modifiers.FirstOrDefault(static m => m.IsKind(SyntaxKind.PartialKeyword));
Copy link
Contributor

Choose a reason for hiding this comment

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

FirstOrDefault

isn't there an indexof that takes in a kind to find?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope!

Copy link
Contributor

Choose a reason for hiding this comment

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

What about this, it's internal, but I thought it would be accessible? Works the way you have it, and I know the lists are small, but it seems weird to always search to find it.

Copy link
Member Author

Choose a reason for hiding this comment

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

What about this, it's internal,

Nope. That's in compiler layer. We don't have IVT to them. We could make an extension at workspace layer, and update to that. i empower you :)

Copy link
Member

@Youssef1313 Youssef1313 Dec 3, 2024

Choose a reason for hiding this comment

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

Isn't it already exposed as an extension method by the compiler itself?

public static int IndexOf(this SyntaxTokenList list, SyntaxKind kind)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good find

if (modifiers.Any())
return (modifiers.Add(s_asyncKeywordWithSpace), returnType);
{
// 'partial' modifier must say at the end of the modifiers arrays.
Copy link
Contributor

Choose a reason for hiding this comment

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

say

nit: stay

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

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

:shipit:

@CyrusNajmabadi CyrusNajmabadi merged commit 98fbf2f into dotnet:main Dec 3, 2024
25 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the makeAsyncPartial branch December 3, 2024 15:41
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Dec 3, 2024
@CyrusNajmabadi CyrusNajmabadi requested review from a team and genlu December 3, 2024 22:14
@CyrusNajmabadi
Copy link
Member Author

@genlu ptal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE 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.

CS4033 creates invalid code on partial methods

4 participants