I am trying to get the AST tree to find the node I want. Based on the doc, I should be able to get the tree like this:

    local parser = vim.treesitter.get_parser(0, vim.o.filetype)
    print('check root', vim.inspect(parser):parse())

But it gives me an error on the second line. What have I done wrong?


The error message is here:

E5108: Error executing lua .../paqs/start/commented.nvim/lua/commented/middlewares.lua:5:
attempt to call method 'parse' (a nil value)
  • 1
    I have added it back in now. sorry for missing that. Jun 2 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.