pwntester / octo.nvim

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

PR review diff bindings not working with `use_local_fs` #457

Open dkasak opened 7 months ago

dkasak commented 7 months ago

Issue Description

Type: bug report

Describe what happened (or what feature you want)

When use_local_fs is used, the review_diff bindings don't appear to be working. For example, the default binding <space>sa for add_review_suggestion doesn't open a suggestion entry window. Is this expected?

Describe what you expected to happen

I would've expected these features to continue working.

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

  1. Set use_local_fs to true.
  2. Open a PR
  3. Start a review.
  4. Select some lines visually.
  5. Press <space>sa, expecting the suggestion entry window to open.

Tell us your environment

NVIM v0.9.4 on Arch Linux.

Anything else we need to know?

N/A

Eryx5502 commented 7 months ago

I was facing the same issue and was investigating a bit. I think the reason why the bindings were missing was, at least in my case, because my normal bindings were overriding Octo's. Easiest way to solve this would be to just remap the desired bindings to something not already in your mappings (changing <space> to <localleader> works for me):

require("octo").setup({
    enable_builtin = true,
    use_local_fs = true,
    mappings = {
      review_diff = {
        add_review_comment = { lhs = "<localleader>ca", desc = "add a new review comment" },
        add_review_suggestion = { lhs = "<localleader>sa", desc = "add a new review suggestion" },
      },
    },
})

Which made me think: maybe a better option for the default mappings would be using <localleader> instead of <space> (which can be <leader> for some of us) to avoid collision of mappings?