Skip to content

Commit ec150c5

Browse files
authored
Merge pull request #52 from nvim-telescope/fix/deprecation
fix: do not use deprecated functions
2 parents 380cb7f + 16891bb commit ec150c5

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
@@ -123,7 +123,7 @@ B.gh_pull_request = function(opts)
123123
opts = opts or {}
124124
opts.limit = opts.limit or 100
125125
local opts_query = parse_opts(opts, "pr")
126-
local cmd = vim.tbl_flatten { "gh", "pr", "list", opts_query }
126+
local cmd = vim.iter({ "gh", "pr", "list", opts_query }):flatten():totable()
127127
local title = "Pull Requests"
128128
msgLoadingPopup("Loading " .. title, cmd, function(results)
129129
if results[1] == "" then
@@ -196,7 +196,7 @@ B.gh_gist = function(opts)
196196
opts.limit = opts.limit or 100
197197
local opts_query = parse_opts(opts, "gist")
198198
local title = "Gist"
199-
local cmd = vim.tbl_flatten { "gh", "gist", "list", opts_query }
199+
local cmd = vim.iter({ "gh", "gist", "list", opts_query }):flatten():totable()
200200
msgLoadingPopup("Loading " .. title, cmd, function(results)
201201
if results[1] == "" then
202202
print("Empty " .. title)
@@ -228,7 +228,7 @@ B.gh_secret = function(opts)
228228
opts = opts or {}
229229
local opts_query = parse_opts(opts, "secret")
230230
local title = "Secret"
231-
local cmd = vim.tbl_flatten { "gh", "secret", "list", opts_query }
231+
local cmd = vim.iter({ "gh", "secret", "list", opts_query }):flatten():totable()
232232
msgLoadingPopup("Loading " .. title, cmd, function(results)
233233
if results[1] == "" then
234234
print("Empty " .. title)
@@ -269,7 +269,7 @@ B.gh_run = function(opts)
269269
opts.cleanmeta = true
270270
end
271271
local opts_query = parse_opts(opts, "run")
272-
local cmd = vim.tbl_flatten { "gh", "run", "list", opts_query }
272+
local cmd = vim.iter({ "gh", "run", "list", opts_query }):flatten():totable()
273273
local title = "Workflow runs"
274274
msgLoadingPopup("Loading " .. title, cmd, function(results)
275275
if results[1] == "" then

0 commit comments

Comments
 (0)