1
0

Setting up conform, Adding phpactor lsp

This commit is contained in:
2024-09-27 20:32:53 +02:00
parent 5c8aeff729
commit 0167c8dbb4
3 changed files with 25 additions and 5 deletions

View File

@@ -16,6 +16,20 @@ return {
},
config = function ()
require("conform").setup()
-- Command to run async formatting
vim.api.nvim_create_user_command("Format", function(args)
local range = nil
if args.count ~= -1 then
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
range = {
start = { args.line1, 0 },
["end"] = { args.line2, end_line:len() },
}
end
require("conform").format({ async = true, lsp_format = "fallback", range = range })
end, { range = true })
end
}