From 97e307a8546f291809a78a99734ba1c7a9c6cac4 Mon Sep 17 00:00:00 2001 From: Will Dean Date: Sat, 2 Nov 2024 14:23:55 -0400 Subject: [PATCH 1/3] add name to the graphql --- lua/octo/gh/graphql.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/octo/gh/graphql.lua b/lua/octo/gh/graphql.lua index a95a160a..b325c695 100644 --- a/lua/octo/gh/graphql.lua +++ b/lua/octo/gh/graphql.lua @@ -2698,6 +2698,7 @@ query($endCursor: String) { nodes { id login + name } } } @@ -2716,6 +2717,7 @@ query($endCursor: String) { nodes { id login + name } } } From 61fcfd396b3aec7381137c40878803ff53992bdd Mon Sep 17 00:00:00 2001 From: Will Dean Date: Sat, 2 Nov 2024 14:24:26 -0400 Subject: [PATCH 2/3] modify the entry maker --- lua/octo/pickers/telescope/entry_maker.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lua/octo/pickers/telescope/entry_maker.lua b/lua/octo/pickers/telescope/entry_maker.lua index 9c7eea5e..25b15757 100644 --- a/lua/octo/pickers/telescope/entry_maker.lua +++ b/lua/octo/pickers/telescope/entry_maker.lua @@ -412,13 +412,25 @@ function M.gen_from_team() end function M.gen_from_user() + local function create_name(user, parens) + if not user.name or user.name == vim.NIL then + return user.login + end + + if parens then + return user.login .. " (" .. user.name .. ")" + end + + return user.login .. user.name + end + local make_display = function(entry) if not entry then return nil end local columns = { - { entry.user.login }, + { create_name(entry.user, true) }, } local displayer = entry_display.create { @@ -438,7 +450,7 @@ function M.gen_from_user() return { value = user.id, - ordinal = user.login, + ordinal = create_name(user, false), display = make_display, user = user, } From b5c7601b9b8d370208fd3a7cbd8561f2b8148317 Mon Sep 17 00:00:00 2001 From: Will Dean Date: Sat, 2 Nov 2024 14:24:45 -0400 Subject: [PATCH 3/3] extract the name for search --- lua/octo/pickers/telescope/provider.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/octo/pickers/telescope/provider.lua b/lua/octo/pickers/telescope/provider.lua index 5385c4d8..20ea58d0 100644 --- a/lua/octo/pickers/telescope/provider.lua +++ b/lua/octo/pickers/telescope/provider.lua @@ -815,6 +815,7 @@ local function get_user_requester() users[user.login] = { id = user.id, login = user.login, + name = user.name, } end elseif user.teams and user.teams.totalCount > 0 then @@ -867,6 +868,7 @@ local function get_users(query_name, node_name) table.insert(users, { id = user.id, login = user.login, + name = user.name, }) end end