Skip to content

feat: comments#332

Open
MattiasMTS wants to merge 2 commits intoesmuellert:mainfrom
MattiasMTS:ms/add-comments-review
Open

feat: comments#332
MattiasMTS wants to merge 2 commits intoesmuellert:mainfrom
MattiasMTS:ms/add-comments-review

Conversation

@MattiasMTS
Copy link

@MattiasMTS MattiasMTS commented Mar 17, 2026

Opening for early comments!

Basically adding this feature similar to conductor workflow for adding comments to code review and pipe it to agent (can be piped to github too etc, anything you want!).

Been testing this a lot recently, here is my integration setup:
https://github.com/MattiasMTS/dotfiles/blob/main/.config/nvim/lua/plugins/codediff.lua#L35
basically claude-code doesn't have a good "send message" API -> so utilzing tmux for that.

demo-nvim.mp4

@MattiasMTS MattiasMTS force-pushed the ms/add-comments-review branch from a5768e4 to 3a5d666 Compare March 17, 2026 17:17
@MattiasMTS
Copy link
Author

@esmuellert if you've time, appreciate iterating on this PR 🙇

@MattiasMTS MattiasMTS force-pushed the ms/add-comments-review branch 2 times, most recently from b6cfd20 to 766fe27 Compare March 18, 2026 08:10
@MattiasMTS
Copy link
Author

I'm also totally ok making this an external plugin that can be integrated with this - if you think it doesn't fit the codebase @esmuellert 🤔

@esmuellert
Copy link
Owner

The comment feature is exactly what I might want for integrating this plugin with more AI features, so I really appreaciate this work! But I am a bit busy recently, didn't get a chance to look through it. I will have a comprehensive assessment in the following days or so, and get back to you. The demo video already looks very good, so mostly likely I will check if it perfectly matches our existing architecture and pattern and iterates a bit if necessary to eventually merge it. Thanks again for this great feature!

@fredrikaverpil
Copy link
Contributor

@MattiasMTS @esmuellert isn't comments very much dependent on which code forge you might be using - like, if you use codeberg, tangled, gitlab, gerrit etc...?

I strongly suggest this kind of feature is written as a plugin to codediff, so that users can opt-in to such features. Don't get me wrong, I'd love this feature and in fact I'm playing around with building something like it myself. As you can see, I'm not integrating it into codediff, as my codediff setup is completely separated from it.

@MattiasMTS
Copy link
Author

isn't comments very much dependent on which code forge you might be using - like, if you use codeberg, tangled, gitlab, gerrit etc...?

this is decoupled. This feature is just about being able to CRUD comments, persist them across sessions etc. Then there is the posthook:

require("codediff.ui.comments").set_submit_hook(...)

that each user will be able to integrate with whatever tool they want. One could argue that this lib would include some sort of "integrations" to e.g. claude, amp, codex, github, etc. But that will be maintenance burden at it's better to either show some examples in docs or encourage users to it themselves.

Again - I'm also totally fine making this a separate plugin - it's not rocket science. Just some in-memory broker + snapshot caching and fancy UI float comments that acts on buffers.

@MattiasMTS
Copy link
Author

with that said, @fredrikaverpil would appreciate if you've review time on the data modelling of the hook function signature to make sure it is riched enough for e.g. GH integration. I haven't looked that much into it, was planning to look into e.g. octa.nvim for inspiration later to do it 🙇

@MattiasMTS MattiasMTS force-pushed the ms/add-comments-review branch from 766fe27 to 7788c39 Compare March 26, 2026 11:29
@MattiasMTS
Copy link
Author

I updated a new push, instead of the post hook we add a dispatch handler functionality:

local comments = require("codediff.ui.comments")

comments.add_sink({
  name = "my-sink",
  enabled = function(context) return true end,       -- optional, default: always enabled
  clear_on_success = true,                            -- optional, default: true
  handler = function(comments, context, done)
    -- sync or async work, then call done
    done(true)  -- or done(false, "error message")
  end,
})

comments.remove_sink("my-sink")
comments.format(comments, context)  -- utility: returns formatted text payload

to handle more functionalities. This ^ would go into each dotfile etc.

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.

3 participants