Fixed powershell formatting on linux/windows, env vars have to be set in term tho
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
require("conform").setup {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
python = { "ruff" },
|
||||
rust = { "rustfmt" },
|
||||
javascript = { "prettier" },
|
||||
typescript = { "prettier" },
|
||||
qml = { "qmlformat" },
|
||||
go = { "gofmt" },
|
||||
sh = { "shfmt" },
|
||||
bash = { "shfmt" },
|
||||
zsh = { "shfmt" },
|
||||
ps1 = {},
|
||||
},
|
||||
format_on_save = {
|
||||
lsp_fallback = true,
|
||||
},
|
||||
}
|
||||
@@ -21,14 +21,13 @@ local capabilities =
|
||||
vim.tbl_deep_extend("force", {}, vim.lsp.protocol.make_client_capabilities(), cmp_lsp.default_capabilities())
|
||||
|
||||
require("fidget").setup {}
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup {
|
||||
automatic_enable = true,
|
||||
automatic_enable = false,
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"qmlls",
|
||||
"rust_analyzer",
|
||||
"gopls",
|
||||
"powershell_es",
|
||||
},
|
||||
handlers = {
|
||||
function(server_name) -- default handler (optional)
|
||||
@@ -51,6 +50,26 @@ require("mason-lspconfig").setup {
|
||||
}
|
||||
end,
|
||||
|
||||
["powershell_es"] = function()
|
||||
local lspconfig = require "lspconfig"
|
||||
lspconfig.powershell_es.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end,
|
||||
|
||||
["rust_analyzer"] = function()
|
||||
local lspconfig = require "lspconfig"
|
||||
lspconfig.rust_analyzer.setup {
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
cargo = { allFeatures = true },
|
||||
checkOnSave = { command = "clippy" },
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
|
||||
zls = function()
|
||||
local lspconfig = require "lspconfig"
|
||||
lspconfig.zls.setup {
|
||||
@@ -67,6 +86,7 @@ require("mason-lspconfig").setup {
|
||||
vim.g.zig_fmt_parse_errors = 0
|
||||
vim.g.zig_fmt_autosave = 0
|
||||
end,
|
||||
|
||||
["lua_ls"] = function()
|
||||
local lspconfig = require "lspconfig"
|
||||
lspconfig.lua_ls.setup {
|
||||
@@ -265,7 +285,7 @@ local servers = {
|
||||
"sourcekit",
|
||||
"qmlls",
|
||||
"tailwindcss",
|
||||
"systemd-lsp",
|
||||
-- "systemd-lsp",
|
||||
require("mason-lspconfig").get_installed_servers(),
|
||||
}
|
||||
|
||||
@@ -273,7 +293,7 @@ local flat_servers = flatten_to_array(servers)
|
||||
|
||||
for _, server in ipairs(flat_servers) do
|
||||
lspconfig(server, {
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach = function(client)
|
||||
if client.name == "typos_lsp" or client.name == "copilot" then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.plugin = {
|
||||
"sbdchd/neoformat",
|
||||
config = function()
|
||||
vim.g.neoformat_enabled_lua = { "luaformatter" }
|
||||
vim.g.neoformat_enabled_python = { "black" }
|
||||
vim.g.neoformat_enabled_javascript = { "prettier" }
|
||||
vim.g.neoformat_enabled_typescript = { "prettier" }
|
||||
vim.g.neoformat_enabled_qml = { "qmlformat" }
|
||||
vim.g.neoformat_enabled_go = { "gofmt" }
|
||||
vim.g.neoformat_enabled_sh = { "shfmt" }
|
||||
vim.g.neoformat_enabled_bash = { "shfmt" }
|
||||
vim.g.neoformat_enabled_zsh = { "shfmt" }
|
||||
vim.g.neoformat_enabled_rust = { "rustfmt" }
|
||||
vim.g.neoformat_enabled_ps1 = { "pwshfmt" }
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user