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

CodeLens doesn't work on records #47445

Closed
PathogenDavid opened this issue Sep 3, 2020 · 22 comments
Closed

CodeLens doesn't work on records #47445

PathogenDavid opened this issue Sep 3, 2020 · 22 comments
Assignees
Labels
Area-IDE Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality Developer Community The issue was originally reported on https://developercommunity.visualstudio.com IDE-IntelliSense Completion, Signature Help, Quick Info New Language Feature - Records Records
Milestone

Comments

@PathogenDavid
Copy link
Contributor

Version Used:

Visual Studio 16.8.0 Preview 2.1
.NET SDK 5.0.100-preview.8.20417.9
Compiler version: '3.8.0-2.20418.7 (0276b9b)'. Language version: 9.0.

Steps to Reproduce:

Enter the following code:

public class Person
{
    public string Name { get; init; }
}

public record PersonRecord
{
    public string Name { get; init; }
}

public static class Factory
{
    public static Person MakePerson(string name)
        => new() { Name = name };

    public static PersonRecord MakeRecord(string name)
        => new() { Name = name };
}

Expected Behavior:

Code Lens shows number of references above PersonRecord and PersonRecord.Name.

Actual Behavior:

Code Lens is missing for record type and its members:

image

@CyrusNajmabadi
Copy link
Member

@jcouv Not critical. @jinujoseph who owns codelens now?

@sharwell
Copy link
Member

sharwell commented Sep 4, 2020

There are two components to CodeLens: a tagger implemented in devdiv (internal) code, and a references provider implemented here in dotnet/roslyn. Both will need to be updated to report tags and information for the new syntax.

@sharwell sharwell added Area-IDE Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality IDE-IntelliSense Completion, Signature Help, Quick Info New Language Feature - Records Records labels Sep 4, 2020
@huoyaoyuan
Copy link
Member

What do you plan for codelens on properties that's only declared in primary constructor? Are they not being able to work with?

@jinujoseph jinujoseph added this to the 16.8 milestone Sep 9, 2020
@CyrusNajmabadi
Copy link
Member

VS PR for this here: https://devdiv.visualstudio.com/DevDiv/_git/VS/pullrequest/279270

@jinujoseph jinujoseph modified the milestones: 16.8, Backlog Nov 12, 2020
@sharwell
Copy link
Member

sharwell commented Nov 13, 2020

🔗 Also reported as AB#1245289

@sharwell sharwell added the Developer Community The issue was originally reported on https://developercommunity.visualstudio.com label Nov 13, 2020
@thomaslevesque
Copy link
Member

In fact, there are a number of things that don't work for records.

@CyrusNajmabadi
Copy link
Member

@thomaslevesque what version of vs are you using?

@thomaslevesque
Copy link
Member

16.8.1

@thomaslevesque
Copy link
Member

In the solution explorer, when you expand a C# file containing a record type, it appears as a method

Sorry, actually I saw that in the screenshot in the feedback item I mentioned. I'm not seeing this on my machine, instead I can't expand the file in the solution explorer if the record is the only type in the file; if there are multiple types, I see the other types, but not the record.

@CyrusNajmabadi
Copy link
Member

Go-to-all:

image

(it's a record)

Solution explorer:

image

Looks like a class.

Change namespace:

image

Move to namespace:

image

@thomaslevesque
Copy link
Member

Wow... are you on 16.8.1 too? I'm seeing this bug on 2 different machines with a fresh VS install.
I just tried again in a different project, and I still have the same issue. As soon as I change the record to a class, the issue disappears.

@CyrusNajmabadi
Copy link
Member

No, i'm on 16.9preview2 :)

@thomaslevesque
Copy link
Member

Ah. Well, at least it's fixed in the next version... Any chance of getting the fix before 16.9 RTM?

@CyrusNajmabadi
Copy link
Member

There is no chance of that happening.

@silkfire
Copy link

@CyrusNajmabadi Is the missing CodeLens reference bug (this issue) fixed in 16.9 too?

@PathogenDavid
Copy link
Contributor Author

@silkfire I can confirm that it is not. (At least not in 16.9 preview 2.)

@CyrusNajmabadi CyrusNajmabadi removed their assignment Feb 24, 2021
@magnusbakken
Copy link

Yeah, I just installed 16.9, and the CodeLens data is still missing for records.

@behzad888
Copy link

I just installed 16.9.1, and the CodeLens data is still missing for records too.

@bfren
Copy link

bfren commented Mar 19, 2021

Anyone know if this is even being worked on at MS? It seems possibly only a minor thing, but actually for stuff like code coverage in tests codelens is invaluable to see at a glance what needs looking at.

@CyrusNajmabadi
Copy link
Member

This currently is not assigned to anyone. We'd need to move it out of our backlog and into a particular release to make this happen.

@CyrusNajmabadi CyrusNajmabadi self-assigned this Mar 22, 2021
@CyrusNajmabadi
Copy link
Member

I'll see if i can make some time in the weekend to get this working.

@CyrusNajmabadi
Copy link
Member

This has been fixed and is in the latest vs (internal) previews:

image

Fixed with: https://devdiv.visualstudio.com/DevDiv/_git/a290117c-5a8a-40f7-bc2c-f14dbe3acf6d/pullrequest/279270

Should be in 16.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality Developer Community The issue was originally reported on https://developercommunity.visualstudio.com IDE-IntelliSense Completion, Signature Help, Quick Info New Language Feature - Records Records
Projects
None yet
Development

No branches or pull requests

10 participants