Skip to content

Conversation

bishoy-at-pieces
Copy link
Collaborator

No description provided.

@Copilot Copilot AI review requested due to automatic review settings July 25, 2025 15:29
Copy link

@Copilot Copilot AI left a 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

Comment on lines +83 to 85
else
print("Failed to get model name")
end
Copy link

Copilot AI Jul 25, 2025

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.

Suggested change
else
print("Failed to get model name")
end
else
print("Split window is not valid")
end

Copilot uses AI. Check for mistakes.

Comment on lines +78 to +81
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
Copy link

Copilot AI Jul 25, 2025

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".

Suggested change
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant