themery#26
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughReplaces the Themery plugin with a custom Telescope-based theme picker integrated with Alacritty, adds formal skill documentation for the ChangesTelescope Theme Picker with Alacritty Sync
nvim-ctx Skill Definition and Timeout Handling
Sequence Diagram(s)sequenceDiagram
participant User
participant open_picker
participant Telescope
participant vim_colorscheme
participant save_theme
participant apply_alacritty
participant alacritty_select
participant fzf
participant sync_nvim
participant theme_json
User->>open_picker: <leader>t or Mini Starter Theme
open_picker->>vim_colorscheme: read colors_name (save original)
open_picker->>Telescope: open themes picker
User->>Telescope: navigate entries (live)
Telescope->>vim_colorscheme: set colorscheme (preview)
alt Confirm <CR>
Telescope->>vim_colorscheme: apply selected scheme
Telescope->>save_theme: write theme.json
vim_colorscheme-->>apply_alacritty: ColorScheme autocmd
apply_alacritty->>apply_alacritty: map name and invoke alacritty-theme
else Cancel <Esc>
Telescope->>vim_colorscheme: restore original colors_name
vim_colorscheme-->>apply_alacritty: ColorScheme autocmd
apply_alacritty->>apply_alacritty: map name and invoke alacritty-theme
end
par Alacritty Side
User->>alacritty_select: run alacritty-theme-select
alacritty_select->>fzf: open theme list
User->>fzf: select theme
fzf->>sync_nvim: translate name
sync_nvim->>theme_json: write mapped colorscheme
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
nvim/.config/nvim/after/plugin/theme.lua (1)
138-142: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueConsider deferring Alacritty sync until theme is confirmed.
The
ColorSchemeautocmd fires on every navigation in the picker sinceapply_selected()changes the colorscheme for live preview. This spawnsalacritty-themepotentially dozens of times during a single browse session.If real-time Alacritty preview is desired, current behavior is correct. Otherwise, consider calling
apply_alacrittyonly fromsave_theme()or withinconfirm()to avoid subprocess spawns during browsing.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@nvim/.config/nvim/after/plugin/theme.lua` around lines 138 - 142, The ColorScheme autocmd callback is firing excessively during theme picker navigation because apply_selected() changes the colorscheme for live preview, causing apply_alacritty to spawn repeatedly. To fix this, remove the call to apply_alacritty from the ColorScheme autocmd callback function, and instead call apply_alacritty directly from the save_theme() or confirm() functions where the user explicitly confirms and saves their theme selection. This will ensure the Alacritty theme only syncs when the user confirms their choice rather than on every preview navigation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@nvim/.config/nvim/after/plugin/theme.lua`:
- Around line 138-142: The ColorScheme autocmd callback is firing excessively
during theme picker navigation because apply_selected() changes the colorscheme
for live preview, causing apply_alacritty to spawn repeatedly. To fix this,
remove the call to apply_alacritty from the ColorScheme autocmd callback
function, and instead call apply_alacritty directly from the save_theme() or
confirm() functions where the user explicitly confirms and saves their theme
selection. This will ensure the Alacritty theme only syncs when the user
confirms their choice rather than on every preview navigation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 142cd5f4-c291-4bc9-958e-5c1d8b9fb4ed
📒 Files selected for processing (3)
nvim/.config/nvim/after/plugin/starter.luanvim/.config/nvim/after/plugin/theme.luanvim/.config/nvim/lua/greg/pack.lua
💤 Files with no reviewable changes (1)
- nvim/.config/nvim/lua/greg/pack.lua
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@alacritty/.local/bin/alacritty-theme-select`:
- Line 3: The NVIM_STATE writes at lines 22-23 and 35 are not resilient because
they directly write to the file without ensuring the parent directory exists,
and they use non-atomic truncation-in-place writes with `>`. To fix this, before
any write operations to NVIM_STATE, ensure the parent directory
~/.local/share/nvim exists by creating it with mkdir -p. Then replace the direct
`>` redirections with atomic writes: write to a temporary file in the same
directory, then use mv to atomically replace the original file. This prevents
failures when the directory doesn't exist and ensures Neovim's file watcher
never sees invalid JSON.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f416c2ce-2f57-4dd4-9661-e232b3a9dfdc
📒 Files selected for processing (2)
alacritty/.local/bin/alacritty-theme-selectnvim/.config/nvim/after/plugin/theme.lua
🚧 Files skipped from review as they are similar to previous changes (1)
- nvim/.config/nvim/after/plugin/theme.lua
| @@ -1,18 +1,47 @@ | |||
| #!/bin/sh | |||
|
|
|||
| NVIM_STATE="$HOME/.local/share/nvim/theme.json" | |||
There was a problem hiding this comment.
Make theme.json writes resilient (ensure directory + atomic replace).
Line 22 and Line 35 write directly to "$NVIM_STATE" with >. If ~/.local/share/nvim doesn’t exist, sync fails; and truncate-in-place can briefly expose invalid JSON to Neovim’s file watcher.
Suggested fix
NVIM_STATE="$HOME/.local/share/nvim/theme.json"
+mkdir -p "$(dirname "$NVIM_STATE")"
+
+write_nvim_state() {
+ _tmp="$(mktemp "${NVIM_STATE}.tmp.XXXXXX")" || return 1
+ printf '{"colorscheme":"%s"}' "$1" > "$_tmp" && mv "$_tmp" "$NVIM_STATE"
+}
@@
- printf '{"colorscheme":"%s"}' "$_s" > "$NVIM_STATE";;
+ write_nvim_state "$_s";;
@@
- printf '{"colorscheme":"%s"}' "$_s" > "$NVIM_STATE"
+ write_nvim_state "$_s"
;;Also applies to: 22-23, 35-35
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@alacritty/.local/bin/alacritty-theme-select` at line 3, The NVIM_STATE writes
at lines 22-23 and 35 are not resilient because they directly write to the file
without ensuring the parent directory exists, and they use non-atomic
truncation-in-place writes with `>`. To fix this, before any write operations to
NVIM_STATE, ensure the parent directory ~/.local/share/nvim exists by creating
it with mkdir -p. Then replace the direct `>` redirections with atomic writes:
write to a temporary file in the same directory, then use mv to atomically
replace the original file. This prevents failures when the directory doesn't
exist and ensures Neovim's file watcher never sees invalid JSON.
Summary by CodeRabbit
Release Notes
New Features
theme.json, auto-reloading on changes and migrating once from prior Themery state.alacritty-theme-select.Improvements
/nvim-ctxnow requests asynchronously with a timeout, with updatednvim-ctxcommand documentation.