]> git.rmz.io Git - dotfiles.git/blob - nvim/lua/plugins/lsp.lua
nvim: disable inlay_hints
[dotfiles.git] / nvim / lua / plugins / lsp.lua
1 return {
2 -- lspconfig
3 {
4 "neovim/nvim-lspconfig",
5 ---@class PluginLspOpts
6 --
7 init = function ()
8 local keys = require("lazyvim.plugins.lsp.keymaps").get()
9
10 -- TODO: setup a new mapping for this
11 -- { "gr", "<cmd>Telescope lsp_references<cr>", desc = "References" },
12 keys[#keys+1] = { "gr", false }
13 end,
14 opts = {
15 inlay_hints = { enabled = false },
16 -- Automatically format on save
17 -- autoformat = false,
18 -- LSP Server Settings
19 ---@type lspconfig.options
20 servers = {
21 lua_ls = {
22 settings = {
23 Lua = {
24 diagnostics = {
25 disable = { "missing-fields", },
26 },
27 },
28 },
29 },
30 -- Add clangd extensions
31 -- https://github.com/p00f/clangd_extensions.nvim
32 },
33 -- you can do any additional lsp server setup here
34 -- return true if you don't want this server to be setup with lspconfig
35 ---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
36 setup = {
37 -- example to setup with typescript.nvim
38 -- tsserver = function(_, opts)
39 -- require("typescript").setup({ server = opts })
40 -- return true
41 -- end,
42 -- Specify * to use this function as a fallback for any server
43 -- ["*"] = function(server, opts) end,
44 },
45 },
46 },
47
48 -- cmdline tools and lsp servers
49 {
50
51 "williamboman/mason.nvim",
52 cmd = "Mason",
53 keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
54 opts = {
55 ensure_installed = {
56 "stylua",
57 "shfmt",
58 -- "flake8",
59 },
60 },
61 ---@param opts MasonSettings | {ensure_installed: string[]}
62 config = function(_, opts)
63 require("mason").setup(opts)
64 local mr = require("mason-registry")
65 local function ensure_installed()
66 for _, tool in ipairs(opts.ensure_installed) do
67 local p = mr.get_package(tool)
68 if not p:is_installed() then
69 p:install()
70 end
71 end
72 end
73 if mr.refresh then
74 mr.refresh(ensure_installed)
75 else
76 ensure_installed()
77 end
78 end,
79 },
80 }