grace icon indicating copy to clipboard operation
grace copied to clipboard

Feature request: Eliding ranges

Open giltho opened this issue 4 months ago • 1 comments

Hello, we sometimes have diagnostics where notes are scattered across various functions in big files (we do interprocedural analysis).

Grace ends up showing half the file, instead of eliding the big ranges that do not have any piece of the diagnostic. It would be good if one could specify the maximum number of lines around diagnostics that one wants to show. Does that make sense?

giltho avatar Aug 23 '25 11:08 giltho

This shouldn't be too difficult, the addition of 'contextual lines' is handled here: https://github.com/johnyob/grace/blob/c8aa9abfd69250b5610f8d7d1e1e914f1d748b9d/lib/ansi_renderer/snippet.ml#L339

By default we add +- 1 lines for contextual lines around multi-line labels. We can easily make this configurable.

johnyob avatar Aug 23 '25 14:08 johnyob