elixir-lsp / elixir-ls

A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
https://elixir-lsp.github.io/elixir-ls/
Apache License 2.0
1.5k stars 196 forks source link

Selection ranges porvider #1060

Closed lukaszsamson closed 9 months ago

lukaszsamson commented 9 months ago

This PR bases on tools built for folding ranges provider in https://github.com/elixir-lsp/elixir-ls/pull/492 with the addition of AST and Code.Fragment.

Similarly to folding ranges, selection ranges works in a number of passes. Each pass generates sets of ranges, that are filtered based on cursor position and sorted from widest to narrowest. Then ranges from each pass are recursively merged with an algorithm that sorts ranges and resolves conflicts.

Addresses https://github.com/elixir-lsp/elixir-ls/issues/534