mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 15:34:53 +01:00
fix: workspace list hints
This commit is contained in:
parent
06fa78e6cc
commit
f2fdaa40a5
1 changed files with 7 additions and 3 deletions
|
@ -4,10 +4,14 @@ local workspace = require('codemp.workspace')
|
||||||
local utils = require('codemp.utils')
|
local utils = require('codemp.utils')
|
||||||
local client = require("codemp.client")
|
local client = require("codemp.client")
|
||||||
|
|
||||||
local function filter(needle, haystack)
|
local function filter(needle, haystack, getter)
|
||||||
local hints = {}
|
local hints = {}
|
||||||
for _, opt in pairs(haystack) do
|
for _, opt in pairs(haystack) do
|
||||||
if vim.startswith(opt, needle) then
|
local hay = opt
|
||||||
|
if getter ~= nil then
|
||||||
|
hay = getter(opt)
|
||||||
|
end
|
||||||
|
if vim.startswith(hay, needle) then
|
||||||
table.insert(hints, opt)
|
table.insert(hints, opt)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -214,7 +218,7 @@ vim.api.nvim_create_user_command(
|
||||||
return filter(lead, session.workspace:filetree())
|
return filter(lead, session.workspace:filetree())
|
||||||
end
|
end
|
||||||
elseif args[#args-1] == 'join' then
|
elseif args[#args-1] == 'join' then
|
||||||
return filter(lead, session.available)
|
return filter(lead, session.available, function(ws) return ws.name end)
|
||||||
end
|
end
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
|
Loading…
Reference in a new issue