VPavliashvili / json-nvim

Powerful Json processing capabilities in your Neovim buffer
MIT License
5 stars 0 forks source link

treesitter.get_node fail because lang is not passed #1

Closed pierrekttipay closed 4 months ago

pierrekttipay commented 4 months ago

I am selecting the simple json object and run the :JsonFormatSelection command

Screenshot 2024-06-01 at 22 55 17

The file is name laravel.log and that why it is failing. Repeating the same process after renaming this file: laravel.json works It's a shame though, we are formatting JSON so we could pass the lang to treesitter independently of the file extension.

Screenshot 2024-06-01 at 22 59 59
VPavliashvili commented 4 months ago

Hello It is failing because your buffer filetype is not set to json. As I have mentioned in prerequisites section in readme, the filetype of the buffer must be a json. That's why I have mentioned there :h filetype command.

Generally you don't need to rename file and set it's extention to .json, running set filetype=json inside buffer will be sufficient.

VPavliashvili commented 4 months ago

after this commit user will see an agreement prompt and if type y buffer filetype will set to json and then will proceed the requested operation.

closing the issue