Conversation
| @@ -0,0 +1,14 @@ | |||
| -- Debug helper: Add this to your Neovim config temporarily to see ALL opencode events | |||
There was a problem hiding this comment.
note: ignore this file, only for debugging, will be removed
4684c3a to
1c8f8f0
Compare
I didn't test this super extensively, especially with new providers. lmk if you find a cause or fix along the way! |
3001781 to
cafdc6f
Compare
|
Hi, how is this going? |
|
@froats , still in testing mode, i havent had too much chance to work on this. Theres something wrong with opening the current version, treesitter sometimes is not correctly attached. Other than that and some QoL stuff, i have been using it without a problem. Although i dont really use the diff features(accept hunk/reject hunk)that often(hunk definition is not that accurate). Please give it a try if you are interested. It is 80% there. I also just attached a screenshot as well. |
|
Opencode actually stores snapshots (git commits in a shadow repo) per-message in |
thank you, didnt know about this. Will check it out tomorrow on MLK day. |
I made a PR #137! |
de5f1cc to
5de2380
Compare
When working with symlinked directories (e.g. ~/.config/nvim -> ~/dotfiles/.config/nvim), Neovim can create separate buffers for the same file if accessed via different paths. This causes issues with the diff view where the actual file might be loaded under one path while the diff tries to open it under another. This commit normalizes all file paths by resolving symlinks and converting to absolute paths, ensuring consistent buffer identity.
When the actual file is already loaded in a buffer (from the user's editing session), opening it with :diffsplit reuses the buffer without triggering FileType events. For users who rely on FileType autocmds to attach Treesitter (via vim.treesitter.start), this causes the diff view to show the file without syntax highlighting. This commit detects if the buffer is already loaded and forces a reload with :edit! before opening in diffsplit. This ensures FileType events fire properly and Treesitter attaches to the buffer. Fixes intermittent "no grammar for filetype found" errors in diff view.
…hment The previous approach of reloading the buffer before diffsplit was not effective because the reload happened in the wrong context and didn't trigger FileType events when the buffer was subsequently opened in diffsplit. This commit takes a direct approach: 1. Open the file with diffsplit 2. Explicitly run :filetype detect to ensure filetype is set 3. Directly call vim.treesitter.start() to attach Treesitter highlighting This ensures syntax highlighting works regardless of whether the buffer was previously loaded or how FileType autocmds are configured. Fixes the issue where right pane has no filetype and no Treesitter highlighting.
cafdc6f to
4a6c770
Compare
Summary
Add PR-style diff review UI for
opencodechanges.This is my rough draft based on some discussion here. I'll be honest and that the
session_diff.luawas mostly AI coded, but was verified and checked for accuracy.Please pull it if you are interested, its been working well for me so far
Screenshots
Key Points
message.updatedevent (contains only current cycle diffs, unlikesession.diffwhichaccumulates everything) for capturing the
before, andafterfor only files touched in the current cycle.vim.diff()unified viewpr reviewstyle enhanced diff view that works withhunk stagingnote:
DiffView.nvimsadly does not really support what we want, since it only works with git rev not local temp files(we are not usinggit, we dont get much fromDiffView.nvimother than the nice UIScreenshot of enhanced diff
Files
lua/opencode/diff.lua- Core review logicplugin/events/session_diff.lua- Event listenerDIFF_FEATURE.md- Full documentationTODOs
planmode should show diff but non-editableBugs
Nice to have?