Skip to content

Commit 657dd6f

Browse files
committed
fix: do not use deprecated functions
These are deprecated in nvim-0.10 that is the oldest version supported by telescope.nvim iteself.
1 parent ee95c50 commit 657dd6f

2 files changed

Lines changed: 12 additions & 13 deletions

File tree

lua/telescope/_extensions/gh_actions.lua

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ local action_state = require "telescope.actions.state"
33
local utils = require "telescope.utils"
44
local Job = require "plenary.job"
55
local state = require "telescope.state"
6-
local flatten = vim.tbl_flatten
76

87
local A = {}
98

@@ -36,7 +35,7 @@ local function gh_qf_action(pr_number, action, msg)
3635
local job = Job:new {
3736
enable_recording = true,
3837
command = "gh",
39-
args = flatten { "pr", action, pr_number },
38+
args = vim.iter({ "pr", action, pr_number }):flatten():totable(),
4039
on_stdout = on_output,
4140
on_stderr = on_output,
4241

@@ -67,13 +66,13 @@ end
6766
A.gh_issue_insert = function(prompt_bufnr)
6867
-- Insert “#10” if issue 10 was selected
6968
local issue_number = close_telescope_prompt(prompt_bufnr)
70-
if vim.api.nvim_buf_get_option(vim.api.nvim_get_current_buf(), "modifiable") then
69+
if vim.api.nvim_get_option_value("modifiable", { buf = vim.api.nvim_get_current_buf() }) then
7170
vim.api.nvim_put({ "#" .. issue_number }, "b", true, true)
7271
end
7372
end
7473

7574
A.gh_issue_insert_markdown_link = function(prompt_bufnr)
76-
if not (vim.api.nvim_buf_get_option(vim.api.nvim_get_current_buf(), "modifiable")) then
75+
if not (vim.api.nvim_get_option_value("modifiable", { buf = vim.api.nvim_get_current_buf() })) then
7776
return
7877
end
7978
local issue_number = close_telescope_prompt(prompt_bufnr)
@@ -328,7 +327,7 @@ A.gh_run_view_log = function(opts)
328327
local job = Job:new {
329328
enable_recording = true,
330329
command = "gh",
331-
args = flatten(args),
330+
args = vim.iter(args):flatten():totable(),
332331
on_stdout = on_output,
333332
on_stderr = on_output,
334333

lua/telescope/_extensions/gh_builtin.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ local function msgLoadingPopup(msg, cmd, complete_fn)
6161
line = row,
6262
width = width,
6363
})
64-
vim.api.nvim_win_set_option(prompt_win, "winhl", "Normal:TelescopeNormal")
65-
vim.api.nvim_win_set_option(prompt_win, "winblend", 0)
64+
vim.api.nvim_set_option_value("winhl", "Normal:TelescopeNormal", { win = prompt_win })
65+
vim.api.nvim_set_option_value("winblend", 0, { win = prompt_win })
6666
local prompt_border_win = prompt_opts.border and prompt_opts.border.win_id
6767
if prompt_border_win then
68-
vim.api.nvim_win_set_option(prompt_border_win, "winhl", "Normal:TelescopePromptBorder")
68+
vim.api.nvim_set_option_value("winhl", "Normal:TelescopePromptBorder", { win = prompt_border_win })
6969
end
7070
vim.defer_fn(
7171
vim.schedule_wrap(function()
@@ -84,7 +84,7 @@ B.gh_issues = function(opts)
8484
opts = opts or {}
8585
opts.limit = opts.limit or 100
8686
local opts_query = parse_opts(opts, "issue")
87-
local cmd = vim.tbl_flatten { "gh", "issue", "list", opts_query }
87+
local cmd = vim.iter({ "gh", "issue", "list", opts_query }):flatten():totable()
8888
local title = "Issues"
8989
msgLoadingPopup("Loading " .. title, cmd, function(results)
9090
if results[1] == "" then
@@ -121,7 +121,7 @@ B.gh_pull_request = function(opts)
121121
opts = opts or {}
122122
opts.limit = opts.limit or 100
123123
local opts_query = parse_opts(opts, "pr")
124-
local cmd = vim.tbl_flatten { "gh", "pr", "list", opts_query }
124+
local cmd = vim.iter({ "gh", "pr", "list", opts_query }):flatten():totable()
125125
local title = "Pull Requests"
126126
msgLoadingPopup("Loading " .. title, cmd, function(results)
127127
if results[1] == "" then
@@ -190,7 +190,7 @@ B.gh_gist = function(opts)
190190
opts.limit = opts.limit or 100
191191
local opts_query = parse_opts(opts, "gist")
192192
local title = "Gist"
193-
local cmd = vim.tbl_flatten { "gh", "gist", "list", opts_query }
193+
local cmd = vim.iter({ "gh", "gist", "list", opts_query }):flatten():totable()
194194
msgLoadingPopup("Loading " .. title, cmd, function(results)
195195
if results[1] == "" then
196196
print("Empty " .. title)
@@ -220,7 +220,7 @@ B.gh_secret = function(opts)
220220
opts = opts or {}
221221
local opts_query = parse_opts(opts, "secret")
222222
local title = "Secret"
223-
local cmd = vim.tbl_flatten { "gh", "secret", "list", opts_query }
223+
local cmd = vim.iter({ "gh", "secret", "list", opts_query }):flatten():totable()
224224
msgLoadingPopup("Loading " .. title, cmd, function(results)
225225
if results[1] == "" then
226226
print("Empty " .. title)
@@ -259,7 +259,7 @@ B.gh_run = function(opts)
259259
opts.cleanmeta = true
260260
end
261261
local opts_query = parse_opts(opts, "run")
262-
local cmd = vim.tbl_flatten { "gh", "run", "list", opts_query }
262+
local cmd = vim.iter({ "gh", "run", "list", opts_query }):flatten():totable()
263263
local title = "Workflow runs"
264264
msgLoadingPopup("Loading " .. title, cmd, function(results)
265265
if results[1] == "" then

0 commit comments

Comments
 (0)