From ea77956c0224d9f9997d60e91642a4e255750f5b Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 14 Nov 2023 18:10:22 +0100 Subject: Add a new blog post --- src/blog/nvim-ts/get-parent.diff.gsp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/blog/nvim-ts/get-parent.diff.gsp (limited to 'src/blog/nvim-ts/get-parent.diff.gsp') 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, -- cgit v1.2.3