Skip to content

feat: range metadata#131

Closed
doorgan wants to merge 1 commit intoelixir-tools:mainfrom
doorgan:doorgan/range-metadata
Closed

feat: range metadata#131
doorgan wants to merge 1 commit intoelixir-tools:mainfrom
doorgan:doorgan/range-metadata

Conversation

@doorgan
Copy link
Copy Markdown
Contributor

@doorgan doorgan commented Apr 29, 2026

Adds a :range property to the nodes metadata

The performance impact of this is detailed in expert-lsp/expert#651
TL;DR I expect this to help quite a bit when indexing large codebases in Expert, but I think I'm getting limited by IO in that project so I can't be 100% confident on that. Profiling shows significant improvements though, but it's not the practical reality I experience.

I decided on this format for the range metadata: %{start: {line, column}, end: {line, column}. The rationale is that keyword ists are really slow to read in a very hot path, while maps have better random access. line/column pairs are tuples for the same reason. {start_line, start_column, end_line, end_column} didn't provide much of an improvement over maps in what I could measure and the ergonomics were terrible(no nice way to get only the start or only the end of a node).

This also adds a new dedicated ranges test file which is mostly a translation of the Sourceror ranges test suite to verify parity/precision. The diff on the spitfire tests is mostly updating assertions to ignore the Spitfire specific metadata when comparing against Elixir's own AST

@doorgan doorgan marked this pull request as draft April 30, 2026 00:32
@doorgan
Copy link
Copy Markdown
Contributor Author

doorgan commented Apr 30, 2026

Despite what profiling initially shows, it does not make a significant difference indexing real projects in expert

@doorgan doorgan closed this Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant