simonw / datasette-ripgrep

Web interface for searching your code using ripgrep, built as a Datasette plugin
https://ripgrep.datasette.io
Apache License 2.0
72 stars 1 forks source link

Show a gap between ranges of lines in search results #27

Closed simonw closed 1 year ago

simonw commented 1 year ago

https://ripgrep.datasette.io/-/ripgrep?pattern=asgi_s&literal=on&glob=datasette%2F**

This is a bit confusing. There should ideally be visual gaps in the line numbers here to make it easier to spot the different ranges:

CleanShot 2022-12-14 at 15 55 39@2x

simonw commented 1 year ago

Here's what the HTML looks like:

<pre><a class="line-number" href="/-/ripgrep/view/datasette/datasette/app.py#L87">87  </a><span>)
</span></pre>
<pre><a class="line-number" href="/-/ripgrep/view/datasette/datasette/app.py#L88">88  </a><span>from .utils.internal_db import init_internal_db, populate_schema_tables
</span></pre>
<pre><a class="line-number" href="/-/ripgrep/view/datasette/datasette/app.py#L200">200 </a><span>
</span></pre>

From this template:

https://github.com/simonw/datasette-ripgrep/blob/577ee2f99ff5dee057e33cbacf57873af2601eb2/datasette_ripgrep/templates/ripgrep.html#L65-L74

simonw commented 1 year ago

So maybe I need to detect when line of code has a line number that's more than one higher than the previous one and add an extra class, maybe <pre class="line-jump"> which can have some extra margin.

simonw commented 1 year ago

https://ripgrep.datasette.io/-/ripgrep?pattern=asgi_s&literal=on&glob=datasette%2F** now looks like this:

image