summaryrefslogtreecommitdiffhomepage
path: root/src/blog/nvim-ts/get-parent.diff.gsp
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-11-14 18:10:22 +0100
committerThomas Voss <mail@thomasvoss.com> 2023-11-14 18:10:22 +0100
commitea77956c0224d9f9997d60e91642a4e255750f5b (patch)
tree7d47222427808b35f9fe07fb5e3249d08fadf109 /src/blog/nvim-ts/get-parent.diff.gsp
parentd31314638a4499ce36def937b61d2069f496eaaa (diff)
Add a new blog post
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,