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>
This commit is contained in:
Simon Hauser
2020-12-09 21:46:41 +01:00
committed by GitHub
parent c276db06e2
commit 141dc6d55e
23 changed files with 148 additions and 356 deletions

View File

@@ -328,7 +328,9 @@ function Picker:find()
a.nvim_win_set_option(results_win, 'winhl', 'Normal:TelescopeNormal')
a.nvim_win_set_option(results_win, 'winblend', self.window.winblend)
local results_border_win = results_opts.border and results_opts.border.win_id
if results_border_win then vim.api.nvim_win_set_option(results_border_win, 'winhl', 'Normal:TelescopeResultsBorder') end
if results_border_win then
vim.api.nvim_win_set_option(results_border_win, 'winhl', 'Normal:TelescopeResultsBorder')
end
local preview_win, preview_opts, preview_bufnr
@@ -339,8 +341,9 @@ function Picker:find()
a.nvim_win_set_option(preview_win, 'winhl', 'Normal:TelescopeNormal')
a.nvim_win_set_option(preview_win, 'winblend', self.window.winblend)
local preview_border_win = preview_opts and preview_opts.border and preview_opts.border.win_id
if preview_border_win then vim.api.nvim_win_set_option(preview_border_win, 'winhl', 'Normal:TelescopePreviewBorder') end
if preview_border_win then
vim.api.nvim_win_set_option(preview_border_win, 'winhl', 'Normal:TelescopePreviewBorder')
end
end
-- TODO: We need to center this and make it prettier...
@@ -407,7 +410,9 @@ function Picker:find()
return
end
local prompt = vim.trim(vim.api.nvim_buf_get_lines(prompt_bufnr, first_line, last_line, false)[1]:sub(#prompt_prefix))
local prompt = vim.trim(
vim.api.nvim_buf_get_lines(prompt_bufnr, first_line, last_line, false)[1]:sub(#prompt_prefix)
)
if self.sorter then
self.sorter:_start(prompt)
@@ -448,7 +453,8 @@ function Picker:find()
end
end
local sort_ok, sort_score = nil, 0
local sort_ok
local sort_score = 0
if self.sorter then
sort_ok, sort_score = self:_track("_sort_time", pcall, self.sorter.score, self.sorter, prompt, entry)
@@ -472,7 +478,7 @@ function Picker:find()
local process_complete = function()
if self:is_done() then return end
-- TODO: We should either: always leave one result or make sure we actually clean up the results when nothing matches
-- TODO: Either: always leave one result or make sure we actually clean up the results when nothing matches
if selection_strategy == 'row' then
if self._selection_row == nil and self.default_selection_index ~= nil then
self:set_selection(self:get_row(self.default_selection_index))
@@ -758,7 +764,9 @@ function Picker:set_selection(row)
end
local caret = '>'
local display = string.format('%s %s', caret, (a.nvim_buf_get_lines(results_bufnr, row, row + 1, false)[1] or ''):sub(3))
local display = string.format('%s %s', caret,
(a.nvim_buf_get_lines(results_bufnr, row, row + 1, false)[1] or ''):sub(3)
)
-- TODO: You should go back and redraw the highlights for this line from the sorter.
-- That's the only smart thing to do.
@@ -835,7 +843,7 @@ function Picker:entry_adder(index, entry, score)
-- This is the two spaces to manage the '> ' stuff.
-- Maybe someday we can use extmarks or floaty text or something to draw this and not insert here.
-- until then, insert two spaces
local prefix = TELESCOPE_DEBUG and (' ' .. score) or ' '
local prefix = ' '
display = prefix .. display
self:_increment("displayed")
@@ -851,7 +859,12 @@ function Picker:entry_adder(index, entry, score)
if set_ok and display_highlights then
-- TODO: This should actually be done during the cursor moving stuff annoyingly.... didn't see this bug yesterday.
for _, hl_block in ipairs(display_highlights) do
a.nvim_buf_add_highlight(self.results_bufnr, ns_telescope_entry, hl_block[2], row, #prefix + hl_block[1][1], #prefix + hl_block[1][2])
a.nvim_buf_add_highlight(self.results_bufnr,
ns_telescope_entry,
hl_block[2],
row,
#prefix + hl_block[1][1],
#prefix + hl_block[1][2])
end
end