pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.36k stars 127 forks source link

No way to identify if PR is Draft or not. #453

Closed daliusd closed 8 months ago

daliusd commented 10 months ago

Issue Description

In PR view you don't see if PR is in Draft state.

Describe what happened (or what feature you want)

No way to identify if PR is Draft or not.

Describe what you expected to happen

I expect to see line indicating that PR is Draft (if it is).

How to reproduce it (as minimally and precisely as possible)

  1. Run :Octo pr list and select PR that is draft
HampusMat commented 8 months ago

I did some investigating and definitely should set virtual text to [DRAFT] as seen here https://github.com/pwntester/octo.nvim/blob/5a04268e54c3f538702ef4f03f635d69c569d23e/lua/octo/ui/writers.lua#L196-L202

Very weird that it's not. I've been irritated over not knowing if a pull request is a draft or not too.

Also, nvim_buf_set_virtual_text is deprecated so it should probably be replaced with nvim_buf_set_extmark

pwntester commented 8 months ago

Sorry for missing this issue. Should be fixed now

HampusMat commented 8 months ago

It still doesn't show in previews 2024-01-18-22:00

HampusMat commented 8 months ago

I was able to fix the preview problem with the following change

--- a/lua/octo/pickers/telescope/previewers.lua
+++ b/lua/octo/pickers/telescope/previewers.lua
@@ -38,6 +38,14 @@ local issue = defaulter(function(opts)
               elseif entry.kind == "pull_request" then
                 obj = result.data.repository.pullRequest
               end
+
+                         OctoBuffer:new {
+                               bufnr = bufnr,
+                               number = obj.number,
+                               repo = entry.repo,
+                               node = obj,
+                         }
+
               writers.write_title(bufnr, obj.title, 1)
               writers.write_details(bufnr, obj)
               writers.write_body(bufnr, obj)

The write_state function relies on there being a buffer in the octo_buffers table but there is none when called from the callback which is called after running Github CLI in the issue previewer

pwntester commented 8 months ago

Thanks @HampusMat Would you mind opening a PR please?

HampusMat commented 8 months ago

Sure