add nix lsp and formatter
This commit is contained in:
@@ -18,3 +18,4 @@ require("config/lsp/bash")
|
|||||||
require("config/lsp/lua")
|
require("config/lsp/lua")
|
||||||
require("config/lsp/web")
|
require("config/lsp/web")
|
||||||
require("config/lsp/php")
|
require("config/lsp/php")
|
||||||
|
require("config/lsp/nix")
|
||||||
|
|||||||
@@ -11,14 +11,11 @@ if not ok then
|
|||||||
end
|
end
|
||||||
|
|
||||||
mason_lspconfig.setup({
|
mason_lspconfig.setup({
|
||||||
ensure_installed = { "lua_ls" },
|
ensure_installed = { "lua_ls", },
|
||||||
})
|
|
||||||
|
|
||||||
mason_tool_installer.setup({
|
|
||||||
ensure_installed = { "stylua", "luacheck" },
|
|
||||||
})
|
})
|
||||||
|
|
||||||
lspconfig.lua_ls.setup({
|
lspconfig.lua_ls.setup({
|
||||||
|
cmd = { "lua-language-server" },
|
||||||
-- capabilities = cmp_nvim_lsp.default_capabilities()
|
-- capabilities = cmp_nvim_lsp.default_capabilities()
|
||||||
capabilities = require("config/lsp/lsp-capabilities"),
|
capabilities = require("config/lsp/lsp-capabilities"),
|
||||||
on_attach = require("config/lsp/lsp-attach"),
|
on_attach = require("config/lsp/lsp-attach"),
|
||||||
@@ -39,6 +36,10 @@ lspconfig.lua_ls.setup({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mason_tool_installer.setup({
|
||||||
|
ensure_installed = { "stylua", "luacheck" },
|
||||||
|
})
|
||||||
|
|
||||||
conform.setup({
|
conform.setup({
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
|
|||||||
59
lua/config/lsp/nix.lua
Normal file
59
lua/config/lsp/nix.lua
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
local ok, lspconfig, conform, lint = pcall(function()
|
||||||
|
return
|
||||||
|
require("lspconfig"),
|
||||||
|
require("conform"),
|
||||||
|
require("lint")
|
||||||
|
end)
|
||||||
|
|
||||||
|
if not ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
lspconfig.nixd.setup({
|
||||||
|
-- capabilities = cmp_nvim_lsp.default_capabilities()
|
||||||
|
capabilities = require("config/lsp/lsp-capabilities"),
|
||||||
|
on_attach = require("config/lsp/lsp-attach"),
|
||||||
|
settings = {
|
||||||
|
nixd = {
|
||||||
|
nixpkgs = {
|
||||||
|
expr = "import <nixpkgs> { }",
|
||||||
|
},
|
||||||
|
-- formatting = {
|
||||||
|
-- command = { "nixfmt" },
|
||||||
|
-- },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- conform.setup({
|
||||||
|
-- formatters_by_ft = {
|
||||||
|
-- nix = { "nixfmt" },
|
||||||
|
-- },
|
||||||
|
-- format_on_save = {
|
||||||
|
-- async = false,
|
||||||
|
-- timeout_ms = 500,
|
||||||
|
-- lsp_format = "fallback",
|
||||||
|
-- },
|
||||||
|
-- })
|
||||||
|
--
|
||||||
|
-- vim.keymap.set({ "n", "v" }, "<leader>lf", function()
|
||||||
|
-- conform.format({
|
||||||
|
-- async = false,
|
||||||
|
-- timeout_ms = 500,
|
||||||
|
-- lsp_format = "fallback",
|
||||||
|
-- })
|
||||||
|
-- end, { desc = "Format" })
|
||||||
|
|
||||||
|
-- lint.linters_by_ft = {
|
||||||
|
-- lua = { "luacheck" },
|
||||||
|
-- }
|
||||||
|
--
|
||||||
|
-- vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||||
|
-- callback = function()
|
||||||
|
-- lint.try_lint()
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
--
|
||||||
|
-- vim.keymap.set("n", "<leader>ll", function()
|
||||||
|
-- lint.try_lint()
|
||||||
|
-- end, { desc = "Lint" })
|
||||||
@@ -13,7 +13,7 @@ end
|
|||||||
mason_lspconfig.setup({
|
mason_lspconfig.setup({
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"intelephense",
|
"intelephense",
|
||||||
"phpactor",
|
--- "phpactor",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user