Skip to content

Commit

Permalink
fix: use _injection_query to decide if the injection formatter is…
Browse files Browse the repository at this point in the history
… valid
  • Loading branch information
mehalter committed Dec 5, 2023
1 parent 18638fe commit 56ace95
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lua/conform/formatters/injected.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ return {
ignore_errors = false,
},
condition = function(self, ctx)
local ok = pcall(vim.treesitter.get_parser, ctx.buf)
local ok, parser = pcall(vim.treesitter.get_parser, ctx.buf)
-- Require Neovim 0.9 because the treesitter API has changed significantly
return ok and vim.fn.has("nvim-0.9") == 1
---@diagnostic disable-next-line: invisible
return ok and parser._injection_query and vim.fn.has("nvim-0.9") == 1
end,
format = function(self, ctx, lines, callback)
local conform = require("conform")
Expand Down

0 comments on commit 56ace95

Please sign in to comment.