diff options
Diffstat (limited to 'lua')
-rw-r--r-- | lua/conform/formatters/init.lua | 7 | ||||
-rw-r--r-- | lua/conform/formatters/prettier.lua | 5 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lua/conform/formatters/init.lua b/lua/conform/formatters/init.lua index c789e12..237d39c 100644 --- a/lua/conform/formatters/init.lua +++ b/lua/conform/formatters/init.lua @@ -1,7 +1,8 @@ local M = {} local uv = vim.uv or vim.loop --- This is used for documentation generation +---@private +---This is used for documentation generation M.list_all_formatters = function() local ret = {} for path in vim.gsplit(vim.o.runtimepath, ",", { plain = true }) do @@ -14,7 +15,9 @@ M.list_all_formatters = function() if entry.name ~= "init.lua" then local basename = string.match(entry.name, "^(.*)%.lua$") local module = require("conform.formatters." .. basename) - ret[basename] = module.meta + local module_data = vim.deepcopy(module.meta) + module_data.has_options = module.options ~= nil + ret[basename] = module_data end end entries = uv.fs_readdir(formatter_dir) diff --git a/lua/conform/formatters/prettier.lua b/lua/conform/formatters/prettier.lua index 0977748..9274577 100644 --- a/lua/conform/formatters/prettier.lua +++ b/lua/conform/formatters/prettier.lua @@ -26,7 +26,8 @@ return { description = [[Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.]], }, options = { - -- add parsers for different filetypes + -- Use a specific prettier parser for a filetype + -- Otherwise, prettier will try to infer the parser from the file name ft_parsers = { -- javascript = "babel", -- javascriptreact = "babel", @@ -45,7 +46,7 @@ return { -- graphql = "graphql", -- handlebars = "glimmer", }, - -- add parsers for different extensions + -- Use a specific prettier parser for a file extension ext_parsers = { -- qmd = "markdown", }, |