From 16891bb8198095edb9656b5989cfc3602d1d2c42 Mon Sep 17 00:00:00 2001 From: delphinus Date: Sat, 17 Jan 2026 21:04:10 +0900 Subject: [PATCH] fix: do not use deprecated functions These are deprecated in nvim-0.10 that is the oldest version supported by telescope.nvim iteself. --- lua/telescope/_extensions/gh_actions.lua | 9 ++++----- lua/telescope/_extensions/gh_builtin.lua | 16 ++++++++-------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lua/telescope/_extensions/gh_actions.lua b/lua/telescope/_extensions/gh_actions.lua index 964f72c..703e2dd 100644 --- a/lua/telescope/_extensions/gh_actions.lua +++ b/lua/telescope/_extensions/gh_actions.lua @@ -3,7 +3,6 @@ local action_state = require "telescope.actions.state" local utils = require "telescope.utils" local Job = require "plenary.job" local state = require "telescope.state" -local flatten = vim.tbl_flatten local A = {} @@ -36,7 +35,7 @@ local function gh_qf_action(pr_number, action, msg) local job = Job:new { enable_recording = true, command = "gh", - args = flatten { "pr", action, pr_number }, + args = vim.iter({ "pr", action, pr_number }):flatten():totable(), on_stdout = on_output, on_stderr = on_output, @@ -67,13 +66,13 @@ end A.gh_issue_insert = function(prompt_bufnr) -- Insert “#10” if issue 10 was selected local issue_number = close_telescope_prompt(prompt_bufnr) - if vim.api.nvim_buf_get_option(vim.api.nvim_get_current_buf(), "modifiable") then + if vim.api.nvim_get_option_value("modifiable", { buf = vim.api.nvim_get_current_buf() }) then vim.api.nvim_put({ "#" .. issue_number }, "b", true, true) end end A.gh_issue_insert_markdown_link = function(prompt_bufnr) - if not (vim.api.nvim_buf_get_option(vim.api.nvim_get_current_buf(), "modifiable")) then + if not (vim.api.nvim_get_option_value("modifiable", { buf = vim.api.nvim_get_current_buf() })) then return end local issue_number = close_telescope_prompt(prompt_bufnr) @@ -328,7 +327,7 @@ A.gh_run_view_log = function(opts) local job = Job:new { enable_recording = true, command = "gh", - args = flatten(args), + args = vim.iter(args):flatten():totable(), on_stdout = on_output, on_stderr = on_output, diff --git a/lua/telescope/_extensions/gh_builtin.lua b/lua/telescope/_extensions/gh_builtin.lua index 2f2d067..62ad976 100644 --- a/lua/telescope/_extensions/gh_builtin.lua +++ b/lua/telescope/_extensions/gh_builtin.lua @@ -61,11 +61,11 @@ local function msgLoadingPopup(msg, cmd, complete_fn) line = row, width = width, }) - vim.api.nvim_win_set_option(prompt_win, "winhl", "Normal:TelescopeNormal") - vim.api.nvim_win_set_option(prompt_win, "winblend", 0) + vim.api.nvim_set_option_value("winhl", "Normal:TelescopeNormal", { win = prompt_win }) + vim.api.nvim_set_option_value("winblend", 0, { win = prompt_win }) local prompt_border_win = prompt_opts.border and prompt_opts.border.win_id if prompt_border_win then - vim.api.nvim_win_set_option(prompt_border_win, "winhl", "Normal:TelescopePromptBorder") + vim.api.nvim_set_option_value("winhl", "Normal:TelescopePromptBorder", { win = prompt_border_win }) end vim.defer_fn( vim.schedule_wrap(function() @@ -84,7 +84,7 @@ B.gh_issues = function(opts) opts = opts or {} opts.limit = opts.limit or 100 local opts_query = parse_opts(opts, "issue") - local cmd = vim.tbl_flatten { "gh", "issue", "list", opts_query } + local cmd = vim.iter({ "gh", "issue", "list", opts_query }):flatten():totable() local title = "Issues" msgLoadingPopup("Loading " .. title, cmd, function(results) if results[1] == "" then @@ -123,7 +123,7 @@ B.gh_pull_request = function(opts) opts = opts or {} opts.limit = opts.limit or 100 local opts_query = parse_opts(opts, "pr") - local cmd = vim.tbl_flatten { "gh", "pr", "list", opts_query } + local cmd = vim.iter({ "gh", "pr", "list", opts_query }):flatten():totable() local title = "Pull Requests" msgLoadingPopup("Loading " .. title, cmd, function(results) if results[1] == "" then @@ -196,7 +196,7 @@ B.gh_gist = function(opts) opts.limit = opts.limit or 100 local opts_query = parse_opts(opts, "gist") local title = "Gist" - local cmd = vim.tbl_flatten { "gh", "gist", "list", opts_query } + local cmd = vim.iter({ "gh", "gist", "list", opts_query }):flatten():totable() msgLoadingPopup("Loading " .. title, cmd, function(results) if results[1] == "" then print("Empty " .. title) @@ -228,7 +228,7 @@ B.gh_secret = function(opts) opts = opts or {} local opts_query = parse_opts(opts, "secret") local title = "Secret" - local cmd = vim.tbl_flatten { "gh", "secret", "list", opts_query } + local cmd = vim.iter({ "gh", "secret", "list", opts_query }):flatten():totable() msgLoadingPopup("Loading " .. title, cmd, function(results) if results[1] == "" then print("Empty " .. title) @@ -269,7 +269,7 @@ B.gh_run = function(opts) opts.cleanmeta = true end local opts_query = parse_opts(opts, "run") - local cmd = vim.tbl_flatten { "gh", "run", "list", opts_query } + local cmd = vim.iter({ "gh", "run", "list", opts_query }):flatten():totable() local title = "Workflow runs" msgLoadingPopup("Loading " .. title, cmd, function(results) if results[1] == "" then