fix statusbar when showing the model in the Copilot#134
fix statusbar when showing the model in the Copilot#134bishoy-at-pieces wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR improves error handling in the Copilot status bar and updates the SDK version requirement. The main purpose is to fix status bar issues when displaying the model in the Copilot interface by adding proper error handling around potentially failing operations.
- Added error handling for model name retrieval and status line setting operations
- Updated minimum SDK version from "4.4.0" to "4.4.1"
- Fixed code formatting and indentation issues in the Python initialization file
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| rplugin/python3/pieces_python/init.py | Updates SDK version requirement and fixes code formatting |
| lua/pieces/copilot/init.lua | Adds error handling for status bar updates with proper pcall wrapping |
| else | ||
| print("Failed to get model name") | ||
| end |
There was a problem hiding this comment.
The error message "Failed to get model name" is misleading. This else branch executes when the split window is invalid or nil, not when getting the model name fails. Consider renaming to "Split window is not valid" or similar.
| else | |
| print("Failed to get model name") | |
| end | |
| else | |
| print("Split window is not valid") | |
| end |
| local status_success, _ = pcall(vim.api.nvim_win_set_option, split.winid, 'statusline', 'Pieces Model: ' .. model_name) | ||
| if not status_success then | ||
| print("Failed to set statusline option") | ||
| end |
There was a problem hiding this comment.
The error message lacks context about why the operation failed. Consider including the actual error or making it more descriptive, such as "Failed to set statusline option for Copilot window".
| local status_success, _ = pcall(vim.api.nvim_win_set_option, split.winid, 'statusline', 'Pieces Model: ' .. model_name) | |
| if not status_success then | |
| print("Failed to set statusline option") | |
| end | |
| local status_success, error_message = pcall(vim.api.nvim_win_set_option, split.winid, 'statusline', 'Pieces Model: ' .. model_name) | |
| if not status_success then | |
| print("Failed to set statusline option for window ID " .. split.winid .. ". Error: " .. error_message) | |
| end |
a67d741 to
cfa6a9d
Compare
No description provided.