diff options
author | Daniil Rozanov <daniilrozzanov@gmail.com> | 2024-04-24 03:34:52 +0300 |
---|---|---|
committer | Daniil Rozanov <daniilrozzanov@gmail.com> | 2024-04-24 03:34:52 +0300 |
commit | f9b36bf730fda5488be87b91fd03a6f7cbf64e73 (patch) | |
tree | d8a7da573111d40c0e51c9e9954a3bb1977dd39c /lua/cmake/telescope/make_entry.lua | |
parent | 672f0d32e322b79661b5d7959887adaa9e41ad98 (diff) |
refactor: full rewrite
Diffstat (limited to 'lua/cmake/telescope/make_entry.lua')
-rw-r--r-- | lua/cmake/telescope/make_entry.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/lua/cmake/telescope/make_entry.lua b/lua/cmake/telescope/make_entry.lua new file mode 100644 index 0000000..d0b04bf --- /dev/null +++ b/lua/cmake/telescope/make_entry.lua @@ -0,0 +1,57 @@ +local make_entry = require("telescope.make_entry") +local entry_display = require("telescope.pickers.entry_display") +local config = require("cmake.config") + +local M = {} + +M.gen_from_configure = function(opts) + local project = require("cmake").project + local displayer = entry_display.create({ + separator = " ", + items = { + { width = project.display.short_len + 5 }, + { remaining = true }, + }, + }) + local make_display = function(entry) + vim.print(entry) + return displayer({ + { entry.value.display.short, "TelescopeResultsIdentifier" }, + { entry.value.display.long, "TelescopeResultsComment" }, + }) + end + return function(entry) + return make_entry.set_default_entry_mt({ + value = entry, + ordinal = table.concat(entry.short, config.variants_display.short_sep), + display = make_display, + }, opts) + end +end + +M.gen_from_build = function(opts) + local project = require("cmake").project + local displayer = entry_display.create({ + separator = " ", + items = { + { width = project.display.short_len + 5 }, + { remaining = true }, + }, + }) + local make_display = function(entry) + vim.print(entry) + return displayer({ + { entry.value.display.short, "TelescopeResultsIdentifier" }, + { entry.value.display.long, "TelescopeResultsComment" }, + }) + end + return function(entry) + return make_entry.set_default_entry_mt({ + value = entry, + ordinal = table.concat(entry.short, config.variants_display.short_sep), + display = make_display, + }, opts) + end +end + +return M |