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/web")
|
||||
require("config/lsp/php")
|
||||
require("config/lsp/nix")
|
||||
|
||||
@@ -7,18 +7,15 @@ local ok, mason_lspconfig, mason_tool_installer, lspconfig, conform, lint = pcal
|
||||
end)
|
||||
|
||||
if not ok then
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = { "lua_ls" },
|
||||
})
|
||||
|
||||
mason_tool_installer.setup({
|
||||
ensure_installed = { "stylua", "luacheck" },
|
||||
ensure_installed = { "lua_ls", },
|
||||
})
|
||||
|
||||
lspconfig.lua_ls.setup({
|
||||
cmd = { "lua-language-server" },
|
||||
-- capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
capabilities = require("config/lsp/lsp-capabilities"),
|
||||
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({
|
||||
formatters_by_ft = {
|
||||
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({
|
||||
ensure_installed = {
|
||||
"intelephense",
|
||||
"phpactor",
|
||||
--- "phpactor",
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
return {
|
||||
"williamboman/mason.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"williamboman/mason.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user