aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAriel D'Alessandro <ariel.dalessandro@auto1.com>2022-03-18 16:03:59 +0100
committerAriel D'Alessandro <ariel.dalessandro@auto1.com>2022-03-18 16:03:59 +0100
commit86f114da90e46e588a5e0a193b6f33e49417c82e (patch)
tree599e56742b5735b8e58a7200cfd5d832f67caf65
parentd23640a29181e5ee7efae42278bb9929bb8bcdbf (diff)
downloadnvim-conf-86f114da90e46e588a5e0a193b6f33e49417c82e.tar.gz
nvim-conf-86f114da90e46e588a5e0a193b6f33e49417c82e.zip
add draft packer compiled
-rw-r--r--lua/alpha/scratchs/draft.lua56
-rw-r--r--plugin/packer_compiled.lua8
2 files changed, 60 insertions, 4 deletions
diff --git a/lua/alpha/scratchs/draft.lua b/lua/alpha/scratchs/draft.lua
index bc0568e..225a64d 100644
--- a/lua/alpha/scratchs/draft.lua
+++ b/lua/alpha/scratchs/draft.lua
@@ -13,3 +13,59 @@ function GlobalFunction()
vim.lsp.util.apply_text_edits(textEdit, bufnr)
end)
end
+
+local ts_locals = require "nvim-treesitter.locals"
+local ts_utils = require "nvim-treesitter.ts_utils"
+
+local get_node_text = vim.treesitter.get_node_text
+
+
+local function get_root_node()
+ local node = ts_utils.get_node_at_cursor()
+ if node == nil then
+ error("No treesitter parser found.")
+ end
+
+ local parent = node:parent()
+ while (parent ~= nil) do
+ node = parent
+ parent = node:parent()
+ end
+
+ return node
+end
+
+-- this function allows me to retrieve all the queries or mutations
+-- from the yaml file
+-- next integrate with telescope to quick search
+-- actions, go to the file line
+-- new action open the php class on the method (lsp maybe, but the problem is not attached)
+function Queries()
+ 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) @name))
+))))))))))
+ )
+)
+ ]]
+ )
+
+ local query = vim.treesitter.get_query("yaml", "GraphQL_endpoints")
+
+ local rootNode = get_root_node()
+ for _, node in query:iter_captures(rootNode, 0, rootNode:start(), rootNode:end_()) do
+ P(get_node_text(node, 0))
+ end
+end
diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua
index 8915dd4..aa9e2a0 100644
--- a/plugin/packer_compiled.lua
+++ b/plugin/packer_compiled.lua
@@ -433,10 +433,6 @@ _G.packer_plugins = {
}
time([[Defining packer_plugins]], false)
--- Config for: git-worktree.nvim
-time([[Config for git-worktree.nvim]], true)
-try_loadstring("\27LJ\2\n>\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\17git-worktree\frequire\0", "config", "git-worktree.nvim")
-time([[Config for git-worktree.nvim]], false)
-- Config for: nvim-projectconfig
time([[Config for nvim-projectconfig]], true)
try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\23nvim-projectconfig\frequire\0", "config", "nvim-projectconfig")
@@ -445,6 +441,10 @@ time([[Config for nvim-projectconfig]], false)
time([[Config for nvim-colorizer.lua]], true)
try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14colorizer\frequire\0", "config", "nvim-colorizer.lua")
time([[Config for nvim-colorizer.lua]], false)
+-- Config for: git-worktree.nvim
+time([[Config for git-worktree.nvim]], true)
+try_loadstring("\27LJ\2\n>\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\17git-worktree\frequire\0", "config", "git-worktree.nvim")
+time([[Config for git-worktree.nvim]], false)
-- Command lazy-loads
time([[Defining lazy-load commands]], true)