Open dibarbet opened 6 months ago
@dibarbet any update on this bug? Can you point me to editor the source implementation, so I can make suggestions or perhaps open a PR myself?
@alcjamgit I'm not 100% sure which extension component is driving this feature in VSCode. I suspect that the Roslyn server needs to implement the LSP textDocument/selectionRange request. We do not implement it today, so it is most likely using some VSCode default behavior or textmate.
We're happy to take contributions - the implementation would go in a new handler in here - https://github.com/dotnet/roslyn/tree/main/src/LanguageServer/Protocol/Handler and set the corresponding capability here https://github.com/dotnet/roslyn/blob/4619ed7bd37e93cccc0fbe8c0832929f309a1eeb/src/LanguageServer/Protocol/DefaultCapabilitiesProvider.cs#L46
We should already have the type definitions for the protocol message, e.g. https://github.com/dotnet/roslyn/blob/4619ed7bd37e93cccc0fbe8c0832929f309a1eeb/src/LanguageServer/Protocol/Protocol/SelectionRange.cs#L16
In Visual Studio, I believe the behavior of expand selection is controlled by this code, which might be a helpful reference (I haven't dug deep into it).
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
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.
Similarly, selection should expand to the currently selected method param's type and name before expanding to other params.
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.