microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
192 stars 6 forks source link

[BUG] C# Base Language Support - Expand selection (alt + shift + right arrow) of methods and other members with body does not work correctly #1059

Closed alcjamgit closed 3 weeks ago

alcjamgit commented 1 month ago

Describe the Issue

Expand selection (alt + shift + right arrow) does not work right when the cursor is currently on the method name. Pressing (alt + shift + right arrow) will expand the selection to the entire method signature (correct). Pressing it further will expand the selection to other same-level members of the type instead of expanding to the method body first.

Steps To Reproduce

  1. Using Windows 11 and VS Code Ensure that "C# Base language support" and "C# DevKit" are installed and enabled.
  2. In VS Code open any C# class with methods and other members.
  3. In VS Code editor put the cursor on any method name and expand the selection by pressing alt + shift + arrow right. Repeat pressing this key until the entire method signature is selected (varies depending on the method name's casing). image
  4. Press alt + shift + arrow right one more time.
  5. Selection is expanded thru the entire class (incorrect). image

This also happens on methods with multiple params. When current cursor is in any of the parameters pressing alt + shift + right arrow expands selection to ALL method params instead of the current selected parameter first (i.e. current param type and param name should be selected first before selecting all params). This is the expected behavior on any other language extension (test this on python) or even in any modern IDE including Visual Studio.

Expected Behavior

Selection should expand to the method body first before other class members. image

Similarly, selection should expand to the currently selected method param's type and name before expanding to other params. image

Environment Information

-OS: Windows 11 -VS Code version 1.88, installed with C# (v2.23.15) and C# Dev Kit (1.4.29) extensions from MS.

dibarbet commented 3 weeks ago

Moved to https://github.com/dotnet/vscode-csharp/issues/7067