fix format

This commit is contained in:
Christian Nieves
2025-03-17 15:51:21 -05:00
parent a9a196baf1
commit a6eee81db6

View File

@ -1,5 +1,16 @@
local use_google = require("utils").use_google local use_google = require("utils").use_google
return {
{
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo", "FormatDisable", "FormatEnable" },
keys = {
-- stylua: ignore
{ "<leader>fmt", function() require("conform").format({ async = true, lsp_fallback = true }) end, mode = "", desc = "Format buffer", },
{ "<leader>fj", ":%!python -m json.tool" },
},
config = function()
vim.g.disable_autoformat = false vim.g.disable_autoformat = false
vim.api.nvim_create_user_command("FormatDisable", function(args) vim.api.nvim_create_user_command("FormatDisable", function(args)
if args.bang then if args.bang then
@ -38,26 +49,16 @@ vim.api.nvim_create_user_command("Format", function(args)
["end"] = { args.line2, end_line:len() }, ["end"] = { args.line2, end_line:len() },
} }
end end
require("conform").format({ async = true, lsp_format = "fallback", range = range }) require("conform").format({ async = true })
end, { range = true }) end, { range = true })
end,
return {
{
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo", "FormatDisable", "FormatEnable" },
keys = {
-- stylua: ignore
{ "<leader>fmt", function() require("conform").format({ async = true, lsp_fallback = true }) end, mode = "", desc = "Format buffer", },
{ "<leader>fj", ":%!python -m json.tool" },
},
-- This will provide type hinting with LuaLS -- This will provide type hinting with LuaLS
---@module "conform" ---@module "conform"
---@type conform.setupOpts ---@type conform.setupOpts
opts = { opts = {
log_level = vim.log.levels.DEBUG, log_level = vim.log.levels.DEBUG,
formatters_by_ft = { formatters_by_ft = {
rust = { "rustfmt", lsp_format = "fallback" }, rust = { "rustfmt" },
-- Conform will run multiple formatters sequentially -- Conform will run multiple formatters sequentially
-- go = { "goimports", "gofmt" }, -- go = { "goimports", "gofmt" },
-- Use a sub-list to run only the first available formatter -- Use a sub-list to run only the first available formatter
@ -65,7 +66,7 @@ return {
-- Conform will run multiple formatters sequentially -- Conform will run multiple formatters sequentially
python = { "isort" }, python = { "isort" },
-- Use a sub-list to run only the first available formatter -- Use a sub-list to run only the first available formatter
javascript = { { "prettier" } }, javascript = { "prettier" },
gdscript = { "gdformat" }, gdscript = { "gdformat" },
ron = { "ronfmt" }, ron = { "ronfmt" },
dashboard = {}, dashboard = {},