Skip to content

Conversation

@schpet
Copy link

@schpet schpet commented Nov 20, 2025

this adds a new hyperlink placeholder: {:line}

similar to {line} but includes a colon prefix when a line is provided, otherwise prints nothing. intended as a fix for #1965 – a problem i ran into with zed.

i'm open to other solutions, such as defaulting line to 1, like what ripgrep does1 – but i feel like it's undesirable to take the user back to line 1 if they have the file open and a cursor on a different line. happy to go with line 1 though if that's preferred (that change now up at #2061)

Footnotes

  1. https://manpages.debian.org/testing/ripgrep/rg.1.en.html#:~:text=number%20was%20given)%2C-,then%20it%20is%20automatically%20replaced%20with%20the%20value%201.,-%7Bcolumn%7D

support for the {:line} placeholder which expands to ":N"
when a line number exists, or empty string otherwise. this prevents
trailing colons from being added to file paths when hyperlinks 
don't have line numbers.

fixes dandavison#1965
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