Tweak autoformatting

This commit is contained in:
mathijs-bakker
2025-09-08 10:16:02 +02:00
parent 32e1ddaa9d
commit 9c53018ab8
2 changed files with 11 additions and 1 deletions

View File

@@ -14,10 +14,12 @@ vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "*.gd",
callback = function()
if vim.fn.executable("gdformat") == 1 then
-- format with gdformat
vim.cmd("silent !gdformat %")
-- reload buffer if changed externally
vim.cmd("checktime")
else
vim.notify("gdformat not found in PATH", vim.log.levels.WARN)
vim.notify("gdformat not found in PATH. Run `:checkhealth godotdev` for more info.", vim.log.levels.WARN)
end
end,
})

View File

@@ -4,6 +4,7 @@ M.opts = {
editor_host = "127.0.0.1",
editor_port = 6005,
debug_port = 6006,
autostart_editor_server = false,
}
function M.setup(opts)
@@ -15,6 +16,13 @@ function M.setup(opts)
})
require("godotdev.start_editor_server")
local editor_server = require("godotdev.start_editor_server")
-- autostart editor server if enabled
if M.opts.autostart_editor_server then
editor_server.start_editor_server()
end
require("godotdev.reconnect_lsp")
require("godotdev.formatting")