-
Notifications
You must be signed in to change notification settings - Fork 425
Description
Feature request: LSP textDocument/selectionRange support
Background
VS Code has a built-in “smart select” feature (triggered by Alt+Shift+Right Arrow) which incrementally expands the selection to the next larger syntactic block — for example:
- inside an expression ➔ whole statement ➔ surrounding method ➔ class ➔ file.
For many languages (like TypeScript or Python), this is powered by the language server implementing the LSP textDocument/selectionRange capability. This allows editor selection to be fully syntax-aware.
The problem with C# today
In C# (via OmniSharp), smart select is limited because textDocument/selectionRange is not implemented. This causes:
- Selections to jump from inside a function directly to selecting the entire file.
- No granular expansion from expression ➔ statement ➔ block ➔ method ➔ class.
This significantly reduces editing productivity compared to other languages in VS Code.
Why this belongs here
OmniSharp acts as the language server backbone for C# in VS Code, including with the new C# Dev Kit. Thus, implementing selectionRange here would immediately benefit all VS Code users working with C#.
Proposal
Please consider adding support for the textDocument/selectionRange LSP request in OmniSharp. This would allow:
✅ Incremental, syntax-aware selection expansion in VS Code.
✅ Consistency with other language experiences in the editor.
✅ Improved developer ergonomics.
References
- LSP spec: selectionRange
- VS Code command:
editor.action.smartSelect.expand - Example implementation for TypeScript:
typescript-language-server
Thank you very much for considering this improvement!