Skip to content

Error: attempt to call method range (a nil value) when in sort function #114

@AlejandroSuero

Description

@AlejandroSuero

Hi @laytan,

I am using neovim v0.12, and when trying to use TailwindSort on a .tsx file (I don't know for the rest of the filetypes), I get the following error:

Lua :command callback: /usr/local/share/nvim/runtime/lua/vim/treesitter.lua:179: attempt to call method 'range' (a nil value)
stack traceback:
        /usr/local/share/nvim/runtime/lua/vim/treesitter.lua:179: in function 'get_range'
        /usr/local/share/nvim/runtime/lua/vim/treesitter.lua:214: in function 'get_node_text'
        ...lazy/tailwind-sorter.nvim/lua/tailwind-sorter/tsutil.lua:23: in function 'get_match_text'
        ...t/lazy/tailwind-sorter.nvim/lua/tailwind-sorter/init.lua:54: in function 'sort'
        ...t/lazy/tailwind-sorter.nvim/lua/tailwind-sorter/init.lua:22: in function <...t/lazy/tailwind-sorter.nvim/lua/tailwind-sorter/init.lua:21>

I can try and look at it if I have time, but since I don't know treesitter as well as you, I will thank you in advance if you know what could be causing to not get the value and have nil instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions