remember to enable lsp

This commit is contained in:
2025-11-19 13:13:50 +01:00
parent c80db2417e
commit 883c4cabb0

View File

@@ -16,17 +16,18 @@ require("fidget").setup({
require('mason').setup({})
require('mason-lspconfig').setup({
ensure_installed = {'bashls', 'clangd', 'marksman', 'pylsp', 'ruff', 'texlab'},
ensure_installed = { 'bashls', 'clangd', 'lua_ls', 'marksman', 'pylsp', 'ruff', 'texlab' },
automatic_enable = false,
})
require('mason-nvim-dap').setup({
ensure_installed = {'bash', 'cppdbg', 'python'},
ensure_installed = { 'bash', 'cppdbg', 'python' },
})
require('dap-python').setup("python")
local servers = {
bashls = {},
clangd = {},
lua_ls = {},
marksman = {},
pylsp = {
settings = {
@@ -96,7 +97,7 @@ local servers = {
},
forwardSearch = {
executable = "zathura",
args = { "--synctex-forward", "%l:1:%f", "%p"}
args = { "--synctex-forward", "%l:1:%f", "%p" }
},
},
},
@@ -124,13 +125,15 @@ local on_attach = function(_client, buffer_number)
-- Use Prettier to format TS/JS if it's available
return format_client.name ~= "tsserver" or not null_ls.is_registered("prettier")
end,
async = false,
timeout_ms = 10000,
})
end, { desc = "LSP: Format current buffer with LSP" })
end
-- Iterate over our servers and set them up
for name, config in pairs(servers) do
vim.lsp.config(name,{
vim.lsp.config(name, {
capabilities = default_capabilities,
filetypes = config.filetypes,
handlers = vim.tbl_deep_extend("force", {}, default_handlers, config.handlers or {}),
@@ -138,6 +141,7 @@ for name, config in pairs(servers) do
settings = config.settings,
init_options = config.init_options,
})
vim.lsp.enable(name)
end
vim.diagnostic.config({
@@ -156,7 +160,7 @@ vim.diagnostic.config({
})
-- Autoformat on save
local fmt_group = vim.api.nvim_create_augroup('autoformat_cmds', {clear = true})
local fmt_group = vim.api.nvim_create_augroup('autoformat_cmds', { clear = true })
local function setup_autoformat(event)
local id = vim.tbl_get(event, 'data', 'client_id')
@@ -165,7 +169,7 @@ local function setup_autoformat(event)
return
end
vim.api.nvim_clear_autocmds({group = fmt_group, buffer = event.buf})
vim.api.nvim_clear_autocmds({ group = fmt_group, buffer = event.buf })
local buf_format = function(e)
vim.lsp.buf.format({
@@ -198,6 +202,6 @@ vim.api.nvim_create_autocmd('LspAttach', {
return
end
vim.lsp.inlay_hint.enable(true, {bufnr = event.buf})
vim.lsp.inlay_hint.enable(true, { bufnr = event.buf })
end,
})