diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2020-12-09 21:46:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-09 15:46:41 -0500 |
| commit | 141dc6d55e4f53ee9527adc164a0d39725394bfd (patch) | |
| tree | 335457a78d554327a7c9e550118c84a7c283a059 /lua/telescope/make_entry.lua | |
| parent | c276db06e2981416995450a4198cef4b87170f6f (diff) | |
ci: Add luacheck ci job (#317)
* Add luacheck ci job
* Fix most of the linting issues
* fixup: lint
Co-authored-by: TJ DeVries <devries.timothyj@gmail.com>
Diffstat (limited to 'lua/telescope/make_entry.lua')
| -rw-r--r-- | lua/telescope/make_entry.lua | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index 66cbcd1..aee7f86 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -77,7 +77,7 @@ do mt_file_entry.cwd = cwd mt_file_entry.display = function(entry) - local display, hl_group = entry.value, nil + local display, hl_group = entry.value if shorten_path then display = utils.path_shorten(display) end @@ -168,8 +168,6 @@ do mt_vimgrep_entry.cwd = vim.fn.expand(opts.cwd or vim.fn.getcwd()) mt_vimgrep_entry.display = function(entry) - local display, hl_group = entry.value, nil - local display_filename if shorten_path then display_filename = utils.path_shorten(entry.filename) @@ -182,7 +180,7 @@ do coordinates = string.format("%s:%s:", entry.lnum, entry.col) end - display, hl_group = transform_devicons( + local display, hl_group = transform_devicons( entry.filename, string.format(display_string, display_filename, coordinates, entry.text), disable_devicons @@ -215,9 +213,7 @@ do end end -function make_entry.gen_from_git_commits(opts) - opts = opts or {} - +function make_entry.gen_from_git_commits() return function(entry) if entry == "" then return nil @@ -361,7 +357,7 @@ function make_entry.gen_from_treesitter(opts) return function(entry) local ts_utils = require('nvim-treesitter.ts_utils') - local start_row, start_col, end_row, end_col = ts_utils.get_node_range(entry.node) + local start_row, start_col, end_row, _ = ts_utils.get_node_range(entry.node) local node_text = ts_utils.get_node_text(entry.node)[1] return { valid = true, @@ -420,9 +416,7 @@ function make_entry.gen_from_packages(opts) end end -function make_entry.gen_from_apropos(opts) - opts = opts or {} - +function make_entry.gen_from_apropos() return function(line) local cmd, _, desc = line:match("^(.*)%s+%((.*)%)%s+%-%s(.*)$") @@ -481,21 +475,21 @@ function make_entry.gen_from_registers(_) end function make_entry.gen_from_highlights() - return function(entry) - local make_display = function(entry) - local display = entry.value - return display, { { { 0, #display }, display } } - end + local make_display = function(entry) + local display = entry.value + return display, { { { 0, #display }, display } } + end - local preview_command = function(entry, bufnr) - local hl = entry.value - vim.api.nvim_buf_set_option(bufnr, 'filetype', 'vim') - local output = vim.split(vim.fn.execute('hi ' .. hl), '\n') - local start = string.find(output[2], 'xxx', 1, true) - vim.api.nvim_buf_set_lines(bufnr, 0, -1, true, output) - vim.api.nvim_buf_add_highlight(bufnr, -1, hl, 1, start - 1, start + 2) - end + local preview_command = function(entry, bufnr) + local hl = entry.value + vim.api.nvim_buf_set_option(bufnr, 'filetype', 'vim') + local output = vim.split(vim.fn.execute('hi ' .. hl), '\n') + local start = string.find(output[2], 'xxx', 1, true) + vim.api.nvim_buf_set_lines(bufnr, 0, -1, true, output) + vim.api.nvim_buf_add_highlight(bufnr, -1, hl, 1, start - 1, start + 2) + end + return function(entry) return { value = entry, display = make_display, @@ -508,12 +502,6 @@ function make_entry.gen_from_highlights() end function make_entry.gen_from_vimoptions() - - -- TODO: Can we just remove this from `options.lua`? - function N_(s) - return s - end - local process_one_opt = function(o) local ok, value_origin |
