nvim-telescope / telescope-github.nvim

Integration with github cli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature proposal: Insertion a ref to the issue with various (contextual) format

kyoh86 opened this issue · comments

commented

Now :Telescope gh issues inserts a reference to the selected issue on <cr> action.
But the reference is formed like #999 regardless of context.
I think that is useful to form them for each context.

Case in markdown:

[feature proposal: Insertion a ref to the issue with various contextual format](https://github.com/nvim-telescope/telescope-github.nvim/issues/39)

Case in commit message:

#39

There may be many contexts, so if it is too complicated to determine a context automatically, I can give up to do it, I may choose the format I want.

Hi there!
It makes sense to insert #39 as you can only reference issues when you're inside the git repo, and GitHub will automatically convert such links to references, i.e.:
Screenshot 2022-04-21 at 08 47 14

However, I do see some use cases for inserting links in markdown format. What if we'll just attach a new mapping, which will insert a link to the issue in markdown format?

As for implementation, this shouldn't be too hard we just need to wrap and parse JSON:

sab@mbp13 ~/g/telescope-github.nvim (master|✔)> gh issue view 39 --json title,url
{
  "title": "feature proposal: Insertion a ref to the issue with various (contextual) format ",
  "url": "https://github.com/nvim-telescope/telescope-github.nvim/issues/39"
}
commented

I prepared a pull-request (#40) for PoC