Include extension properties in object initializer completion#81498
Include extension properties in object initializer completion#81498CyrusNajmabadi merged 4 commits intomainfrom
Conversation
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
|
@copilot inside AbstractObjectInitializerCompletionProvider we should add the extension properties we can find off of |
| } | ||
| """, "PropC"); | ||
|
|
||
| [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/77484")] |
There was a problem hiding this comment.
Updated all WorkItem links to #81405 in commit 1293665.
| } | ||
| """; | ||
|
|
||
| await VerifyItemIsAbsentAsync(markup, "ReadOnlyProp"); |
There was a problem hiding this comment.
@copilot add test that shows that we would show it if it was public List<int> ReadOnlyProp because then the user could write new MyClass { ReadOnlyProp = { ... } }
There was a problem hiding this comment.
Added ExtensionPropertyInObjectInitializer_ReadOnlyCollectionShown test in commit 1293665 that verifies a read-only List<int> extension property is shown for collection initializer syntax new MyClass { ReadOnlyListProp = { ... } }.
The change at commit |
| } | ||
| """, "PropC"); | ||
|
|
||
| [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/77484")] |
There was a problem hiding this comment.
@copilot place all new tests in CSharpCompletionCommandHandlerTests.vb instead.
There was a problem hiding this comment.
Moved all extension property tests from ObjectInitializerCompletionProviderTests.cs to CSharpCompletionCommandHandlerTests.vb in commit c2cdb13.
…operty Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
…rTests.cs to CSharpCompletionCommandHandlerTests.vb Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Extension properties were not appearing in IntelliSense within object initializers, though they worked correctly for direct property access.
Changes
includeReducedExtensionMethods: truetoLookupSymbolsinAbstractObjectInitializerCompletionProviderto include extension members in the symbol lookupTests
Added tests in
CSharpCompletionCommandHandlerTests.vbverifying:new MyClass { ReadOnlyListProp = { ... } })Fixes #81497
Fixes #81405
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.