octo.nvim icon indicating copy to clipboard operation
octo.nvim copied to clipboard

Feature Request: Popup to create pr/issues ..

Open kkharji opened this issue 4 years ago • 4 comments

Issue Description

Type: feature request

Describe what happened (or what feature you want)

I'd like to be simplify the way I create pr/issues and not having to wait and be promoted with a new buffer.

currently the steps to create an issue for me, goes as follows:

  1. run :Octo issue create (I bind it to <leader>gic)
  2. enter issue title in command line
  3. wait till the create request finish
  4. open a buffer (which I ONLY NEED TO WRITE DESCRIPTION)
  5. write a message
  6. choose labels (optional)

Describe what you expected to happen

I'd like to have some sort of global create menu. Where in this menu is all the stuff that can be created using github cli or some git related stuff.

After choosing, say issue. a popup with something like:


## Issue Title:
 |
## Issue description
<!-- You can Leave Empty-->
|<TAB to jump here>

Then on :w<CR> or in insert <C-c> the buffer will be parsed and sent to the api.

Then I'd like to be notified using something like notified using something like https://github.com/rcarriga/nvim-notify when the issue is created or when some network error happened (possibly cache the buffer for retry).

So the steps becomes as follows

  1. run require'octo.telescope.menu'.create()
  2. select something that can be created using github api or git
  3. small popup enter required fields in a markdown form.
  4. hit <C-c> in insert mode or <leader>w in normal mode to save.
  5. continue what I was doing
  6. get notified when things the network request is done 💯

Anything else we need to know?

I'd something that involved parsing markdown form

first I write the following in empty popup buffer

{
    "#### Purpose",
    "",
    (opts.branch_desc or "") .. ".",
    "",
    "#### Details",
    "",
    first_commit_body,
 }

then after saving the buffer, I send the buffer to a function that does the following

    local content = vim.api.nvim_buf_get_lines(win.bufnr, 0, -1, false)
    local title = content[2]
    local body = table.concat(vim.list_slice(content, 6, #content), "\n")
 --- ....

kkharji avatar Aug 17 '21 13:08 kkharji

Hey @tami5

I had something similar on mind but with no menus/popups. What about:

  • Octo issue|pr create
  • new octo buffer with empty title and body is created
  • user enters title and body (signcolumn indicators turn red)
  • user saves the buffer (signcolumn indicators turn white) and vim.notify informs if the issue/pr was created successfully

pwntester avatar Aug 17 '21 22:08 pwntester

well that is good enough @pwntester. I can later create a custom menu, and if it's stable enough maybe open a pr.

the main pain point for me is having to wait until the request for creating an issue is created.

EDIT: oh I thought just menus are being dropped. Popup are really simple and too then get out of your ways, and it would be fun to toggle them.

kkharji avatar Aug 17 '21 22:08 kkharji

Maybe #163 is enough for the menu thing. As for the popup, wouldnt you have to wait till the issue is created to show the octo buffer after entering the details on the popup? What Im suggesting is creating the octo buffer staight away and then create the issue on the background on the first save

pwntester avatar Aug 18 '21 08:08 pwntester

Maybe #163 is enough for the menu thing. As for the popup, wouldnt you have to wait till the issue is created to show the octo buffer after entering the details on the popup? What Im suggesting is creating the octo buffer staight away and then create the issue on the background on the first save

not sure if I understand what you're saying here but basically, yah no wait between creating the issue/pr and first save.

As for popup, it should just be a swap for regular splits and I think it would be an easy implementation. I'd like to see an option to only use popup for all octo buffer and be anle to toggle on/off them. But that's something for another feature request.

for now between entering title and description shouldn't be a network request.

As for UI, one place to write title and description

kkharji avatar Aug 19 '21 06:08 kkharji