Skip to content
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

MetadataAsSource should show scoped modifiers #64906

Open
RikkiGibson opened this issue Oct 21, 2022 · 5 comments
Open

MetadataAsSource should show scoped modifiers #64906

RikkiGibson opened this issue Oct 21, 2022 · 5 comments
Labels
Area-IDE help wanted The issue is "up for grabs" - add a comment if you are interested in working on it New Language Feature - Ref Fields
Milestone

Comments

@RikkiGibson
Copy link
Contributor

RikkiGibson commented Oct 21, 2022

Definitely think that MetadataAsSource should show scoped modifiers. At a glance it seems like it doesn't. See MemoryMarshal.CreateSpan. (The point of this method is to be unsafe and claim it doesn't capture the parameter when it really does.)

        //
        // Summary:
        //     Creates a new span over a portion of a regular managed object.
        //
        // Parameters:
        //   reference:
        //     A reference to data.
        //
        //   length:
        //     The number of T elements that reference contains.
        //
        // Type parameters:
        //   T:
        //     The type of the data items.
        //
        // Returns:
        //     A span.
        public static Span<T> CreateSpan<T>(ref T reference, int length);
@RikkiGibson RikkiGibson added this to the 17.5 milestone Oct 21, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Oct 21, 2022
@Youssef1313
Copy link
Member

@RikkiGibson There doesn't seem to be completion for scoped. This should be a high priority

image

@Youssef1313
Copy link
Member

Youssef1313 commented Nov 14, 2022

Also we likely will want to handle scoped ref here:

// ref |
// ref readonly |
// for ( ref |
// foreach ( ref | x
if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.ReadOnlyKeyword)
{
var parent = token.Parent;
if (parent is (kind: SyntaxKind.RefType or SyntaxKind.RefExpression or SyntaxKind.LocalDeclarationStatement))
{
if (parent.IsParentKind(SyntaxKind.VariableDeclaration) &&
parent.Parent?.Parent is (kind:
SyntaxKind.LocalDeclarationStatement or
SyntaxKind.ForStatement or
SyntaxKind.ForEachVariableStatement))
{
return true;
}
if (parent.Parent is (kind: SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement))
{
return true;
}
}
}

and make sure use implicit vs explicit type works for scoped ref variables as well (in for loops, out arguments, local declarations).

@Youssef1313
Copy link
Member

I'm working on completion.

@arkalyanms
Copy link
Member

@cston / @RikkiGibson is this still a 17.5 candidate?

@arkalyanms arkalyanms removed the untriaged Issues and PRs which have not yet been triaged by a lead label Jan 6, 2023
@cston cston modified the milestones: 17.5, 17.6 Jan 6, 2023
@RikkiGibson
Copy link
Contributor Author

RikkiGibson commented Feb 15, 2023

Re-triaging this. Deleted the question about showing 'scoped out' for implicit 'scoped' in out parameters. I think we don't need to be more verbose than the language default in this case.

re: quick info generally, I'm honestly not sure whether/how to show the scoped modifier, particularly because I don't know how to show [UnscopedRef]. @dotnet/roslyn-ide ultimately has the say on what should be included in Quick Info, so tagging them for guidance.

Definitely think that MetadataAsSource should show scoped modifiers. At a glance it seems like it doesn't. See MemoryMarshal.CreateSpan. (The point of this method is to be unsafe and claim it doesn't capture the parameter when it really does.)

        //
        // Summary:
        //     Creates a new span over a portion of a regular managed object.
        //
        // Parameters:
        //   reference:
        //     A reference to data.
        //
        //   length:
        //     The number of T elements that reference contains.
        //
        // Type parameters:
        //   T:
        //     The type of the data items.
        //
        // Returns:
        //     A span.
        public static Span<T> CreateSpan<T>(ref T reference, int length);

@jcouv jcouv modified the milestones: 17.6, 17.7 Jun 12, 2023
@RikkiGibson RikkiGibson modified the milestones: 17.7, 17.8 Jul 12, 2023
@RikkiGibson RikkiGibson changed the title IDE changes for 'ref fields' feature MetadataAsSource should show scoped modifiers Jan 2, 2024
@RikkiGibson RikkiGibson modified the milestones: 17.8, Backlog Jan 2, 2024
@RikkiGibson RikkiGibson added the help wanted The issue is "up for grabs" - add a comment if you are interested in working on it label Jan 2, 2024
@RikkiGibson RikkiGibson removed their assignment Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE help wanted The issue is "up for grabs" - add a comment if you are interested in working on it New Language Feature - Ref Fields
Projects
None yet
Development

No branches or pull requests

5 participants