Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lua/pieces/copilot/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,15 @@ end

local function update_status_bar()
if split ~= nil and type(split.winid) == "number" and vim.api.nvim_win_is_valid(split.winid) == true then
vim.api.nvim_win_set_option(split.winid, 'statusline', 'Pieces Model: '.. vim.fn.PiecesGetModel())
local success, model_name = pcall(vim.fn.PiecesGetModel)
if success and model_name then
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
Comment on lines +78 to +81
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.

end
else
print("Failed to get model name")
end
Comment on lines +83 to 85
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.

end

Expand Down
12 changes: 6 additions & 6 deletions plugin/pieces.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require("pieces.copilot")
require("pieces.assets")
require("pieces.copilot.slash_commands")
require("pieces.onboarding")
require("pieces.feedback")
require("pieces.tutor")
require("pieces.copilot")
require("pieces.assets")
require("pieces.copilot.slash_commands")
require("pieces.onboarding")
require("pieces.feedback")
require("pieces.tutor")
37 changes: 22 additions & 15 deletions rplugin/python3/pieces_python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,31 @@
import pynvim
import pip


def update_sdks():
pip.main(["install","pieces_os_client","--upgrade"])
pip.main(["install", "pieces_os_client", "--upgrade"])


MIN_SDKS_VERSION = "4.4.0"
MIN_SDKS_VERSION = "4.4.1"
try:
from pieces_os_client import __version__ as pieces_os_client_version
from pieces_os_client import __version__ as pieces_os_client_version

try: # If there is any issue in the version checker then it is outdated
from pieces_os_client.wrapper.version_compatibility import VersionChecker

try: # If there is any issue in the version checker then it is outdated
from pieces_os_client.wrapper.version_compatibility import VersionChecker
VersionChecker.compare("1.0.0","1.0.0") # Check also that the compare is working too
except (AttributeError, ModuleNotFoundError):
update_sdks()
raise ModuleNotFoundError
VersionChecker.compare(
"1.0.0", "1.0.0"
) # Check also that the compare is working too
except (AttributeError, ModuleNotFoundError):
update_sdks()
raise ModuleNotFoundError

if VersionChecker.compare(pieces_os_client_version,MIN_SDKS_VERSION) < 0: # We need to be above 4.0.0
update_sdks()
raise ModuleNotFoundError
from .main import Pieces
if (
VersionChecker.compare(pieces_os_client_version, MIN_SDKS_VERSION) < 0
): # We need to be above 4.0.0
update_sdks()
raise ModuleNotFoundError
from .main import Pieces
except ModuleNotFoundError:
pip.main(["install","pieces_os_client"])
from .main import Pieces
pip.main(["install", "pieces_os_client"])
from .main import Pieces
2 changes: 1 addition & 1 deletion rplugin/python3/pieces_python/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.5.1"
__version__ = "1.5.2"