4 "neovim/nvim-lspconfig",
5 ---@class PluginLspOpts
8 local keys = require("lazyvim.plugins.lsp.keymaps").get()
10 -- TODO: setup a new mapping for this
11 -- { "gr", "<cmd>Telescope lsp_references<cr>", desc = "References" },
12 keys[#keys+1] = { "gr", false }
15 -- Automatically format on save
16 -- autoformat = false,
17 -- LSP Server Settings
18 ---@type lspconfig.options
24 disable = { "missing-fields", },
29 -- Add clangd extensions
30 -- https://github.com/p00f/clangd_extensions.nvim
32 root_dir = function(fname)
33 return require("lspconfig.util").root_pattern("pyproject.toml", "setup.cfg", "ruff.toml")(fname)
40 autopep8 = { enabled = false },
41 flake8 = { enabled = false },
42 mccabe = { enabled = false },
43 pycodestyle = { enabled = false },
44 pydocstyle = { enabled = false },
45 pyflakes = { enabled = false }, -- covered by flake8
51 -- you can do any additional lsp server setup here
52 -- return true if you don't want this server to be setup with lspconfig
53 ---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
55 -- example to setup with typescript.nvim
56 -- tsserver = function(_, opts)
57 -- require("typescript").setup({ server = opts })
60 -- Specify * to use this function as a fallback for any server
61 -- ["*"] = function(server, opts) end,
66 -- cmdline tools and lsp servers
69 "williamboman/mason.nvim",
71 keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
79 ---@param opts MasonSettings | {ensure_installed: string[]}
80 config = function(_, opts)
81 require("mason").setup(opts)
82 local mr = require("mason-registry")
83 local function ensure_installed()
84 for _, tool in ipairs(opts.ensure_installed) do
85 local p = mr.get_package(tool)
86 if not p:is_installed() then
92 mr.refresh(ensure_installed)