Skip to content

Commit 5d3240d

Browse files
Merge pull request #133 from pieces-app/update-sdks-min-version
update sdks min version
2 parents 95dba3e + aa4eb92 commit 5d3240d

File tree

4 files changed

+38
-16
lines changed

4 files changed

+38
-16
lines changed

lua/pieces/copilot/context/paths.lua

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
local M = {}
22
local Popup = require("nui.popup")
33
local Layout = require('nui.layout')
4-
local cmp = require('cmp')
4+
local has_cmp, cmp = pcall(require, 'cmp')
55
local icons = require('nvim-web-devicons')
66
local ListUpdater = require("pieces.list_updater")
77
local relevance = require("pieces.copilot.relevance_table")
@@ -33,12 +33,20 @@ local function get_paths(path)
3333
if not name then break end
3434
local full_path = dir .. name
3535
if type == "directory" then
36-
table.insert(items, { label = full_path .. "/", kind = cmp.lsp.CompletionItemKind.Folder })
36+
local item = { label = full_path .. "/" }
37+
if has_cmp then
38+
item.kind = cmp.lsp.CompletionItemKind.Folder
39+
end
40+
table.insert(items, item)
3741
else
3842
local extension = full_path:match("^.+%.(.+)$")
3943
for _,v in ipairs(relevance) do
4044
if extension == v then
41-
table.insert(items, { label = full_path, kind = cmp.lsp.CompletionItemKind.File })
45+
local item = { label = full_path }
46+
if has_cmp then
47+
item.kind = cmp.lsp.CompletionItemKind.File
48+
end
49+
table.insert(items, item)
4250
goto continue
4351
end
4452
end
@@ -53,6 +61,10 @@ end
5361

5462

5563
local function setup_source()
64+
if not has_cmp then
65+
return
66+
end
67+
5668
local source = {}
5769
source.new = function()
5870
return setmetatable({}, { __index = source })
@@ -77,11 +89,13 @@ end
7789
setup_source()
7890

7991
M.setup_buffer = function(bufnr)
80-
cmp.setup.buffer({
81-
sources = {
82-
{ name = 'pieces_file_path' }
83-
},
84-
}, bufnr)
92+
if has_cmp then
93+
cmp.setup.buffer({
94+
sources = {
95+
{ name = 'pieces_file_path' }
96+
},
97+
}, bufnr)
98+
end
8599
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
86100
end
87101

lua/pieces/copilot/slash_commands.lua

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local context = require("pieces.copilot.context.ui")
22
local M = {}
33
local commands
4+
local has_cmp, cmp = pcall(require, 'cmp')
45

56
-- Function to return the commands with the args
67
local function _commands()
@@ -74,7 +75,10 @@ local function buffer_has_words()
7475
end
7576

7677
local function setup_source()
77-
local cmp = require('cmp')
78+
if not has_cmp then
79+
return
80+
end
81+
7882
local source = {}
7983
source.new = function()
8084
return setmetatable({}, { __index = source })
@@ -109,11 +113,15 @@ M.setup_buffer = function(bufnr)
109113
if commands == nil then
110114
commands = _commands()
111115
end
112-
require 'cmp'.setup.buffer({
113-
sources = {
114-
{ name = 'pieces_slash_commands_input' }
115-
},
116-
}, bufnr)
116+
117+
if has_cmp then
118+
cmp.setup.buffer({
119+
sources = {
120+
{ name = 'pieces_slash_commands_input' }
121+
},
122+
}, bufnr)
123+
end
124+
117125
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
118126
end
119127

rplugin/python3/pieces_python/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
def update_sdks():
66
pip.main(["install","pieces_os_client","--upgrade"])
77

8-
MIN_SDKS_VERSION = "4.3.0"
8+
MIN_SDKS_VERSION = "4.4.0"
99
try:
1010
from pieces_os_client import __version__ as pieces_os_client_version
1111

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.5.0"
1+
__version__ = "1.5.1"

0 commit comments

Comments
 (0)