Skip to content

Implement textDocument/selectionRange to enable language-aware smart select in VS Code #2678

@JulzDave

Description

@JulzDave

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

Thank you very much for considering this improvement!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions