In this video, I'll be writing a neovim plugin. If you're new to neovim, or if you just want to watch an interesting plugin writing process, then watch this video! This video shows how to use the treesitter APIs in Lua to grab information about some Typescript code, then modifies text in the buffer. It should be fun.
Chapters
0:00 - Intro
1:13 - Query syntax
2:33 - Using treesitter playground
10:02 - What we're building
11:53 - Setting up the lua plugin
14:35 - Figuring out the first query
16:05 - Using the query in Lua
18:55 - Getting TSNode at the cursor
21:43 - Getting parent nodes
26:22 - Getting nodes recursively
27:44 - A bit of refactoring...
28:56 - Welcome along to the ride...
20:57 - Crafting the output string
33:46 - table.concat
35:32 - Writing the result to the buffer
39:36 - it didn't work.
42:13 - it works!
9 Comments