Closed magnuslarsen closed 1 month ago
This is fantastic, thanks for the PR!
Thank you! For anyone using the latest nvim-treesitter
, the query
parser used to format the files got some breaking changes, so I had to use the following to get it to work (recognize the latest parser rather than the one bundled with neovim):
local qfmt = require('conform.formatters.format-queries')
local nvim_ts_path = vim.fn.stdpath('data') .. '/lazy/nvim-treesitter/'
util.add_formatter_args(qfmt, { '-c', 'set rtp^=' .. nvim_ts_path })
NOTE: This will only work when using lazy but you can replace nvim_ts_path
with your path to nvim-treesitter and it will work
@ribru17 thanks for the tip! I've incorporated that into the formatter
Awesome, thank you!
Thanks both of you!
I found out that nvim-treesitter comes with a formatter; that they themselves use to format their queries:\ https://github.com/nvim-treesitter/nvim-treesitter/blob/ea2b137f35fb1e87a6471ec311805920fdf45745/.github/workflows/lint.yml#L36-L51
They maintain it, and it ships with the plugin... So why not use it?
I threw this a little hastily together; if you have some better ideas for the condition or anything else, please let me know :-)