:CodeDiff explorer refuses to open on a clean working tree ("No changes to show")

Aperta Adatta ai principianti
#582 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
lua
Ambito
tooling

Direzione di ricerca

Inizia da lua/codediff/commands/handlers/explorer.lua, nel controllo che notifica "No changes to show" e termina. Individua dove il percorso auto_refresh mostra la pagina di benvenuto ("Working tree is clean — no changes to display.") e riutilizza quella stessa visualizzazione per l'apertura iniziale quando non è stato fornito alcun argomento di revisione. Lascia la notifica per i confronti di revisioni esplicite. Aggiungi explorer.open_when_clean ai valori predefiniti della configurazione e alla documentazione. Poi verifica a mano: :CodeDiff su un albero pulito mostra la pagina di benvenuto e recepisce una modifica successiva.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Use case

I keep the :CodeDiff explorer open while a coding agent (or a build or a formatter) changes the repo, and watch the changes come in through auto_refresh. I usually open it before anything has changed, when the working tree is clean.

Current behavior

On a clean tree, :CodeDiff shows No changes to show and does not open:

-- lua/codediff/commands/handlers/explorer.lua (v4.0.6)
if #status_result.unstaged == 0 and #status_result.staged == 0 and not has_conflicts then
  vim.notify("No changes to show", vim.log.levels.INFO)
  return
end

The explorer already supports an empty state. If every change is reverted while it's open, refresh shows the welcome page ("Working tree is clean — no changes to display.") and keeps watching. Only the initial open is blocked.

Steps to reproduce
  1. Use a repo with a clean working tree (e.g. after git stash -u).
  2. Run :CodeDiff. It shows "No changes to show" and nothing opens.
  3. Compare: run :CodeDiff with one modified file, then git checkout .. The explorer stays open on the welcome page and picks up later edits.
Proposal

Open the explorer with the welcome page when there are no changes, so it behaves the same as when it becomes clean after opening. If the current behavior should stay the default, put the new behavior behind an option, e.g.:

explorer = {
  open_when_clean = true, -- open on the welcome page instead of notifying "No changes to show"
}

This probably only applies to the bare working-tree form (:CodeDiff with no revision). Comparing two fixed revisions with no differences can't change later, so the current notice still fits there.

I'm happy to send a PR if you're open to it.

Environment: codediff.nvim v4.0.6 (09d9ebe), Neovim, macOS. Config: diff = { layout = 'inline', compact = true }.

Lingua principale
Lua
Stelle
1.6k
Fork
104
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di esmuellert/codediff.nvim

Tutte le issue di esmuellert/codediff.nvim

Issue simili

Altre issue su Lua

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.