-
Notifications
You must be signed in to change notification settings - Fork 676
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
Offer generate constructor in more places #7682
Comments
@DanteMarshal I'm able to see the refactorings for generating a constructor. For example by selecting the fields: The selection can be a bit finicky. Putting your cursor on a field variable should show an action to generate a ctor with that field. Selecting multiple fields should show an option to generate a ctor with all. |
I'm not 100% sure we ever offered to generate all on the class definition (definitely possible, but I can't remember off the top of my head). However I agree that it currently isn't very ergonomic to use. I've updated the title of this issue - we'll use it to track improvements in how and when the code action is offered. Unfortunately I'm not sure if all of these will be extremely easy to offer. For example, LSP doesn't seem to provide multiple selection ranges to server at all - so that may require base LSP updates (which tend to take a while). |
Type: Bug
Issue Description
There used to be a quick action on structs and classes to automatically generate a constructor injecting all defined fields. I don't recall exactly since which version, but I can't find that option anymore since the past month or so.
Steps to Reproduce
Open quick actions menu on a class or a struct with defined fields and no constructor.
Expected Behavior
A
Generate Constructor 'ClassName( field1, field2, ... )'
should be available.Actual Behavior
On classes, only
Generate Constructor ClassName()
is available, and on structs no option to generate any kind of constructor is available.Logs
Nothing out of ordinary happens, no errors or warnings are reported. It's as if this feature was totally removed.
Environment information
VSCode version: 1.90.2
C# Extension: 2.50.27
Using OmniSharp: false
Dotnet Information
.NET SDK: Version: 8.0.403 Commit: c64aa40a71 Workload version: 8.0.400-manifests.e99c892e MSBuild version: 17.11.9+a69bbaaf5Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.403\
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.
Host:
Version: 8.0.10
Architecture: x64
Commit: 81cabf2857
.NET SDKs installed:
8.0.403 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Visual Studio Code Extensions
Extension version: 2.50.27
VS Code version: Code 1.90.2 (5437499feb04f7a586f677b155b039bc2b3669eb, 2024-06-18T22:34:26.404Z)
OS version: Windows_NT x64 10.0.22631
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
The text was updated successfully, but these errors were encountered: