Files
nvim-config/lua/configs/lspconfig.lua
T
2026-07-23 20:53:15 +02:00

97 lines
2.0 KiB
Lua
Executable File

-- Mason setup
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = {
"html",
"cssls",
"quick_lint_js",
"clangd",
"ts_ls",
"lua_ls",
},
})
require("mason-tool-installer").setup({
ensure_installed = {
"black",
"debugpy",
"flake8",
"isort",
"mypy",
"pylint",
},
})
-- NvChad LSP defaults
local nvlsp = require("nvchad.configs.lspconfig")
-- Define servers
local servers = { "html", "cssls", "basedpyright", "quick_lint_js", "qmlls", "nixd" }
-- Use the new Neovim 0.11 LSP config API
for _, server in ipairs(servers) do
vim.lsp.config(server, {
on_attach = nvlsp.on_attach,
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
})
end
vim.lsp.config("lua_ls", {
settings = {
Lua = {
workspace = {
library = {
"/usr/share/hypr/stubs",
},
},
},
},
})
vim.lsp.config("nixd", {
cmd = { "nixd" },
filetypes = { "nix" },
root_markers = { "flake.nix", ".git" },
settings = {
nixd = {
nixpkgs = {
expr = 'import (builtins.getFlake "/home/user/nix-config").inputs.nixpkgs { }',
},
formatting = {
command = { "nixfmt" },
},
options = {
nixos = {
expr = '(builtins.getFlake "/home/user/nix-config").nixosConfigurations.nixos.options',
},
home_manager = {
expr = '(builtins.getFlake "/home/user/nix-config").nixosConfigurations.nixos.options.home-manager.users.type.getSubOptions []',
},
},
},
},
})
vim.lsp.config("basedpyright", {
cmd = { "/run/current-system/sw/bin/basedpyright-langserver", "--stdio" },
settings = {
pyright = {
disableOrganizeImports = true
},
basedpyright = {
analysis = {
typeCheckingMode = "standard"
}
}
}
})
vim.filetype.add({
extension = {
log = "log",
},
})
vim.lsp.enable(servers)