vim.lsp.config("lua_ls", {
	settings = {
		Lua = {
			diagnostics = { globals = { "vim" } },
			workspace = { library = vim.api.nvim_get_runtime_file("", true) },
		},
	},
})

-- Enable servers (mason-lspconfig handles this automatically for installed ones)
-- vim.lsp.enable("lua_ls")

-- diagnostic
vim.diagnostic.config({
	virtual_text = {
		prefix = "●", -- Icône avant le message
		source = "if_many", -- Affiche la source LSP si plusieurs
		format = function(diag)
			return string.format("%s: %s", diag.source, diag.message)
		end,
	},
	signs = true,
	underline = true,
	update_in_insert = false, -- Évite flicker en insert
	severity_sort = true,
})
