nvim-conf/after/plugin/null-ls.lua, branch main
Neovim configuration
feat: refactor null ls into lsp module
2023-01-08T19:17:00+00:00
Ariel D'Alessandro
dalessandro.ariel@gmail.com
2023-01-08T19:17:00+00:00
927037c181f379076ab295db0a65e7f713c05a10
feat: refactor lsp & cmp to lua folder from after
2023-01-08T08:58:56+00:00
Ariel D'Alessandro
dalessandro.ariel@gmail.com
2023-01-08T08:58:56+00:00
f7bcac5ee5db56081981bb946a66d3fc34807988
remove floaterm, update null ls to use global phpstan, remove gpt plugin
2022-12-29T13:43:22+00:00
Ariel D'Alessandro
ariel.dalessandro@auto1.com
2022-12-29T13:43:22+00:00
5195a215d1ceb8e53d49699fbf5bbc1d4d8b81ba
fix dressing, change lualine re-add null-ls
2022-12-11T10:00:28+00:00
Ariel D'Alessandro
dalessandro.ariel@gmail.com
2022-12-11T10:00:04+00:00
e96308e884375f3a876938f8c83600741f3aa6dd
small kitty update, disbable codespell
2022-11-29T08:18:13+00:00
Ariel D'Alessandro
ariel.dalessandro@auto1.com
2022-11-29T08:17:54+00:00
97a268339d2ad04b6d18fa2fec3cf555f47c7266
feat: reconfigure fonts
2022-11-19T10:46:18+00:00
Ariel D'Alessandro
dalessandro.ariel@gmail.com
2022-11-19T10:46:18+00:00
86c78b727294f7ab10e9521140a899ed4a9a166f
feature themes and get back to kitty
2022-11-18T17:31:18+00:00
Ariel D'Alessandro
dalessandro.ariel@gmail.com
2022-11-18T17:30:59+00:00
03f76fcb586d61364a3bf80d865a284396f8bda1
feat: small improvements
2022-10-23T20:44:27+00:00
Ariel D'Alessandro
dalessandro.ariel@gmail.com
2022-10-23T20:44:27+00:00
0bd826dd6b205e1133a0541b8959ac3e0253f046
set on save for the diagnostic sources
2022-10-04T12:42:36+00:00
Ariel D'Alessandro
ariel.dalessandro@auto1.com
2022-10-04T12:42:36+00:00
b52a4e554f54e5a374febcd069a2e4b9c0d81e4c
small improvements and wip
2022-09-30T15:25:10+00:00
Ariel D'Alessandro
ariel.dalessandro@auto1.com
2022-09-30T15:25:10+00:00
a424a58b5e178f6ad9d878d0e4825bb507f50d9d
href='#n79'>79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
local pickers = require "telescope.pickers"
local finders = require "telescope.finders"
local conf = require ( "telescope.config" ). values
local action_state = require "telescope.actions.state"
local action_set = require "telescope.actions.set"
local actions = require "telescope.actions"
local get_node_text = vim . treesitter . get_node_text
local gateway = {}
local get_definition_buffer = function ( type )
local uri = vim . uri_from_fname ( vim . fn . getcwd () .. "/config/graphql/_" .. type .. ".yaml" )
local buff = vim . uri_to_bufnr ( uri )
vim . fn . bufload ( buff )
return buff
end
local get_all_definitions = function ()
local mutations_definitions = gateway . get_graphql_definitions ( get_definition_buffer "mutation" )
local queries_definitions = gateway . get_graphql_definitions ( get_definition_buffer "query" )
for _ , definition in ipairs ( queries_definitions ) do
table.insert ( mutations_definitions , definition )
end
return mutations_definitions
end
-- "'@=mutation(\"App\\\\GraphQL\\\\Mutations\\\\Mutation::action\", ...)'",
local open_resolver = function ( resolver )
-- need to parse to get this values
local args = string.match ( resolver , "'@=mutation%((.+)%)'" )
if args == nil then
args = string.match ( resolver , "'@=query%((.+)%)'" )
end
if args == nil then
P "error resolver"
P ( resolver )
return
end
local args_tbl = vim . split ( args , ", " )
local fqn = string.match ( args_tbl [ 1 ], '"(.+)"' )
fqn = string.gsub ( fqn , " \\\\ " , " \\ " )
-- P(fqn)
require ( "alpha.php.lsp" ). find ( fqn , "phpactor" )
end
--- @param bufnr integer Buff id
gateway . get_graphql_definitions = function ( bufnr )
vim . treesitter . set_query (
"yaml" ,
"GraphQL_endpoints" ,
[[
(document (block_node (block_mapping (block_mapping_pair
value: (block_node (block_mapping (block_mapping_pair
value: (block_node (block_mapping (block_mapping_pair
value: (block_node (block_mapping (block_mapping_pair
key: (flow_node) @mutation
value: (block_node (block_mapping (block_mapping_pair
key: (flow_node) @resolve (#eq? @resolve "resolve")
value: (flow_node) @resolver
)))
)))
)))
)))
))))
]]
)
local query = vim . treesitter . get_query ( "yaml" , "GraphQL_endpoints" )
local elements = {}
local parsers = require "nvim-treesitter.parsers"
local parser = parsers . get_parser ( bufnr )
local tree = parser : parse ()[ 1 ]
for id , node in query : iter_captures ( tree : root (), bufnr ) do
if query . captures [ id ] == "mutation" then
table.insert ( elements , {
value = get_node_text ( node , bufnr ),
lnum = node : start () + 1 ,
buffer = bufnr ,
})
elseif query . captures [ id ] == "resolver" then
elements [ # elements ]. resolver = get_node_text ( node , bufnr )
end
end
return elements
end
--- gets the graphql function defined on a given buffer
--- @param opts table: options to pass to the picker
gateway . graphql_definitions = function ( opts )
opts = opts or {}
pickers
. new ( opts , {
promt_title = "Queries" ,
finder = finders . new_table {
results = get_all_definitions (),
entry_maker = function ( entry )
-- buffer = 43,
-- lnum = 82,
-- resolver = "'@=mutation(\"App\\\\GraphQL\\\\Mutation\\\\Mutation::action\", ...)'",
-- value = "deleteVehicleImage"
return {
value = entry ,
display = entry . value ,
ordinal = entry . value ,
path = vim . api . nvim_buf_get_name ( entry . buffer ),
lnum = entry . lnum ,
resolver = entry . resolver ,
}
end ,
},
sorter = conf . generic_sorter ( opts ),
previewer = conf . grep_previewer ( opts ),
attach_mappings = function ( prompt_bufnr , map )
action_set . select : enhance {
post = function ()
local selection = action_state . get_selected_entry ()
vim . api . nvim_win_set_cursor ( 0 , { selection . lnum , 0 })
end ,
}
map ( "i" , "<c-o>" , function ()
actions . close ( prompt_bufnr )
local selection = action_state . get_selected_entry ()
open_resolver ( selection . resolver )
end )
return true
end ,
})
: find ()
end
return gateway