Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions lua/telescope/_extensions/gh_actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}

Expand Down Expand Up @@ -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,

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,

Expand Down
16 changes: 8 additions & 8 deletions lua/telescope/_extensions/gh_builtin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down