summaryrefslogtreecommitdiffhomepage
path: root/src/blog/nvim-ts/get-parent.diff.gsp
diff options
context:
space:
mode:
Diffstat (limited to 'src/blog/nvim-ts/get-parent.diff.gsp')
-rw-r--r--src/blog/nvim-ts/get-parent.diff.gsp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/blog/nvim-ts/get-parent.diff.gsp b/src/blog/nvim-ts/get-parent.diff.gsp
new file mode 100644
index 0000000..eebfeb5
--- /dev/null
+++ b/src/blog/nvim-ts/get-parent.diff.gsp
@@ -0,0 +1,14 @@
+ if node == nil then
+ error('No Tree-Sitter parser found.')
+ end
+@span .diff-ins {-+}
+@span .diff-ins {-+ while node ~= nil and node:type() ~= 'operation' do}
+@span .diff-ins {-+ node = node:parent()}
+@span .diff-ins {-+ end}
+@span .diff-ins {-+}
+@span .diff-ins {-+ if node ~= nil then}
+@span .diff-ins {-+ -- TODO}
+@span .diff-ins {-+ end}
+ end, {
+ buffer = true,
+ noremap = true,