Skip to content

Commit f0915e6

Browse files
committed
chore: sort imports, consistent naming
1 parent 23d263f commit f0915e6

24 files changed

Lines changed: 133 additions & 123 deletions

lua/telescope/actions/generate.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ local config = require "telescope.config"
2424
local action_state = require "telescope.actions.state"
2525
local finders = require "telescope.finders"
2626

27-
local action_generate = {}
27+
local M = {}
2828

2929
---@inlinedoc
3030
---@class telescope.actions.generate.which_key.opts
@@ -52,14 +52,14 @@ local action_generate = {}
5252
--- - Resolves to minimum required number of lines to show hints with `opts` or truncates entries at `max_height`.
5353
--- - Closes automatically on action call and can be disabled with by setting `close_with_action` to false.
5454
---@param opts table: options to pass to toggling registered actions
55-
action_generate.which_key = function(opts)
55+
M.which_key = function(opts)
5656
local which_key = function(prompt_bufnr)
5757
actions.which_key(prompt_bufnr, opts)
5858
end
5959
return which_key
6060
end
6161

62-
action_generate.refine = function(prompt_bufnr, opts)
62+
M.refine = function(prompt_bufnr, opts)
6363
opts = opts or {}
6464
opts.prompt_to_prefix = vim.F.if_nil(opts.prompt_to_prefix, false)
6565
opts.prefix_hl_group = vim.F.if_nil(opts.prompt_hl_group, "TelescopePromptPrefix")
@@ -115,4 +115,4 @@ action_generate.refine = function(prompt_bufnr, opts)
115115
current_picker:refresh(new_finder, opts)
116116
end
117117

118-
return action_generate
118+
return M

lua/telescope/actions/history.lua

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
local conf = require("telescope.config").values
1+
local uv = vim.uv
2+
23
local Path = require "neoplen.path"
3-
local utils = require "telescope.utils"
44

5-
local uv = vim.uv
5+
local conf = require("telescope.config").values
6+
local utils = require "telescope.utils"
67

78
---@brief
89
--- A base implementation of a prompt history that provides a simple history
@@ -40,7 +41,7 @@ local append_async = function(path, txt)
4041
write_async(path, txt, "a")
4142
end
4243

43-
local histories = {}
44+
local M = {}
4445

4546
--- Manages prompt history
4647
---@class History @Manages prompt history
@@ -50,8 +51,8 @@ local histories = {}
5051
---@field content table: History table. Needs to be filled by your own History implementation
5152
---@field index number: Used to keep track of the next or previous index. Default is #content + 1
5253
---@field cycle_wrap boolean: Controls if history will wrap on reaching beginning or end
53-
histories.History = {}
54-
histories.History.__index = histories.History
54+
M.History = {}
55+
M.History.__index = M.History
5556

5657
---@inlinedoc
5758
---@class telescope.actions.history.opts
@@ -62,7 +63,7 @@ histories.History.__index = histories.History
6263

6364
--- Create a new History
6465
---@param opts table: Defines the behavior of History
65-
function histories.History:new(opts)
66+
function M.History:new(opts)
6667
local obj = {}
6768
if conf.history == false or type(conf.history) ~= "table" then
6869
obj.enabled = false
@@ -86,12 +87,12 @@ function histories.History:new(opts)
8687
end
8788

8889
--- Shorthand to create a new history
89-
function histories.new(...)
90-
return histories.History:new(...)
90+
function M.new(...)
91+
return M.History:new(...)
9192
end
9293

9394
--- Will reset the history index to the default initial state. Will happen after the picker closed
94-
function histories.History:reset()
95+
function M.History:reset()
9596
if not self.enabled then
9697
return
9798
end
@@ -102,7 +103,7 @@ end
102103
---@param line string: current line that will be appended
103104
---@param picker table: the current picker object
104105
---@param no_reset boolean: On default it will reset the state at the end. If you don't want to do this set to true
105-
function histories.History:append(line, picker, no_reset)
106+
function M.History:append(line, picker, no_reset)
106107
if not self.enabled then
107108
return
108109
end
@@ -113,7 +114,7 @@ end
113114
---@param line string: the current line
114115
---@param picker table: the current picker object
115116
---@return string: the next history item
116-
function histories.History:get_next(line, picker)
117+
function M.History:get_next(line, picker)
117118
if not self.enabled then
118119
utils.notify("History:get_next", {
119120
msg = "You are cycling to next the history item but history is disabled. Read ':help telescope.defaults.history'",
@@ -142,7 +143,7 @@ end
142143
---@param line string: the current line
143144
---@param picker table: the current picker object
144145
---@return string: the previous history item
145-
function histories.History:get_prev(line, picker)
146+
function M.History:get_prev(line, picker)
146147
if not self.enabled then
147148
utils.notify("History:get_prev", {
148149
msg = "You are cycling to next the history item but history is disabled. Read ':help telescope.defaults.history'",
@@ -174,8 +175,8 @@ end
174175
--- A simple implementation of history.
175176
---
176177
--- It will keep one unified history across all pickers.
177-
histories.get_simple_history = function()
178-
return histories.new {
178+
M.get_simple_history = function()
179+
return M.new {
179180
init = function(obj)
180181
local p = Path:new(obj.path)
181182
if not p:exists() then
@@ -213,4 +214,4 @@ histories.get_simple_history = function()
213214
}
214215
end
215216

216-
return histories
217+
return M

lua/telescope/actions/init.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@
5050

5151
local api = vim.api
5252

53+
local popup = require "neoplen.popup"
54+
5355
local conf = require("telescope.config").values
5456
local state = require "telescope.state"
5557
local utils = require "telescope.utils"
56-
local popup = require "neoplen.popup"
5758
local p_scroller = require "telescope.pickers.scroller"
5859

5960
local action_state = require "telescope.actions.state"

lua/telescope/actions/set.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99

1010
local api = vim.api
1111

12-
local log = require "telescope.log"
1312
local Path = require "neoplen.path"
13+
14+
local log = require "telescope.log"
1415
local state = require "telescope.state"
1516
local utils = require "telescope.utils"
1617

lua/telescope/builtin/__files.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
local api = vim.api
22

3+
local Path = require "neoplen.path"
4+
35
local action_state = require "telescope.actions.state"
46
local action_set = require "telescope.actions.set"
57
local actions = require "telescope.actions"
@@ -12,10 +14,7 @@ local utils = require "telescope.utils"
1214
local conf = require("telescope.config").values
1315
local log = require "telescope.log"
1416

15-
local Path = require "neoplen.path"
16-
1717
local flatten = utils.flatten
18-
local filter = vim.tbl_filter
1918

2019
local files = {}
2120

@@ -63,7 +62,7 @@ local get_open_filelist = function(grep_open_files, cwd)
6362
return nil
6463
end
6564

66-
local bufnrs = filter(function(b)
65+
local bufnrs = vim.tbl_filter(function(b)
6766
if 1 ~= vim.fn.buflisted(b) then
6867
return false
6968
end

lua/telescope/builtin/__git.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
local api = vim.api
22

3+
local strings = require "neoplen.strings"
4+
local Path = require "neoplen.path"
5+
36
local actions = require "telescope.actions"
47
local action_state = require "telescope.actions.state"
58
local finders = require "telescope.finders"
@@ -9,8 +12,6 @@ local pickers = require "telescope.pickers"
912
local previewers = require "telescope.previewers"
1013
local utils = require "telescope.utils"
1114
local entry_display = require "telescope.pickers.entry_display"
12-
local strings = require "neoplen.strings"
13-
local Path = require "neoplen.path"
1415

1516
local conf = require("telescope.config").values
1617
local git_command = utils.__git_command

lua/telescope/builtin/__internal.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
local api = vim.api
22

3+
local Path = require "neoplen.path"
4+
35
local actions = require "telescope.actions"
46
local action_set = require "telescope.actions.set"
57
local action_state = require "telescope.actions.state"
68
local finders = require "telescope.finders"
79
local make_entry = require "telescope.make_entry"
8-
local Path = require "neoplen.path"
910
local pickers = require "telescope.pickers"
1011
local previewers = require "telescope.previewers"
1112
local p_window = require "telescope.pickers.window"

lua/telescope/builtin/__lsp.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ local api = vim.api
44
local lsp = vim.lsp
55

66
local channel = require("neoplen.async.control").channel
7+
78
local actions = require "telescope.actions"
89
local sorters = require "telescope.sorters"
910
local conf = require("telescope.config").values

lua/telescope/config.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local strings = require "neoplen.strings"
2+
23
local sorters = require "telescope.sorters"
3-
local has_win = vim.fn.has "win32" == 1
4+
local iswin = vim.fn.has "win32" == 1
45

56
-- Keep the values around between reloads
67
_TelescopeConfigurationValues = _TelescopeConfigurationValues or {}
@@ -597,7 +598,7 @@ append(
597598
append(
598599
"preview",
599600
{
600-
check_mime_type = not has_win,
601+
check_mime_type = not iswin,
601602
filesize_limit = 25,
602603
highlight_limit = 1,
603604
timeout = 250,

lua/telescope/finders/async_oneshot_finder.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
local async = require "neoplen.async"
2+
23
local async_job = require "telescope.async_job"
34
local LinesPipe = async_job.LinesPipe
45

0 commit comments

Comments
 (0)