summaryrefslogtreecommitdiffhomepage
path: root/src/blog/nvim-ts/get-parent.diff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-02-23 15:19:26 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-02-23 15:19:26 +0100
commit208ddaa76019af05d1e0f352912dab38ceedad6b (patch)
treeeafd9aefa77d7cf9581c2e4de87968d700d74aaf /src/blog/nvim-ts/get-parent.diff
parentab6d91982264623ae626115349d2c8a7579f1b1e (diff)
Add nvim-ts article
Diffstat (limited to 'src/blog/nvim-ts/get-parent.diff')
-rw-r--r--src/blog/nvim-ts/get-parent.diff14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/blog/nvim-ts/get-parent.diff b/src/blog/nvim-ts/get-parent.diff
new file mode 100644
index 0000000..9599792
--- /dev/null
+++ b/src/blog/nvim-ts/get-parent.diff
@@ -0,0 +1,14 @@
+ if node == nil then
+ error('No Tree-Sitter parser found.')
+ end
++
++ while node ~= nil and node:type() ~= 'operation' do
++ node = node:parent()
++ end
++
++ if node ~= nil then
++ -- TODO
++ end
+ end, {
+ buffer = true,
+ noremap = true,