-
Notifications
You must be signed in to change notification settings - Fork 4
fix statusbar when showing the model in the Copilot #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Copilot
AI
Jul 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Copilot uses AI. Check for mistakes.
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 |
Copilot
AI
Jul 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Copilot uses AI. Check for mistakes.
a67d741
to
cfa6a9d
Compare
No description provided.