nvim dot files

add rust to lsp config

+28 -4
+28 -4
lua/plugins/lsp.lua
··· 11 11 "williamboman/mason-lspconfig.nvim", 12 12 config = function() 13 13 require('mason-lspconfig').setup({ 14 - ensure_installed = { "pyright", "tsserver", "rust_analyzer" }, 14 + ensure_installed = { "pyright", "tsserver", "rust_analyzer", "zls" }, 15 15 }) 16 16 end, 17 17 }, ··· 33 33 34 34 lspconfig.pyright.setup({ on_attach = on_attach }) 35 35 lspconfig.tsserver.setup({ on_attach = on_attach }) 36 + lspconfig.rust_analyzer.setup({ 37 + on_attach = on_attach, 38 + settings = { 39 + ["rust-analyzer"] = { 40 + imports = { 41 + granularity = { 42 + group = "module", 43 + }, 44 + prefix = "self", 45 + }, 46 + cargo = { 47 + buildScripts = { 48 + enable = true, 49 + }, 50 + }, 51 + procMacro = { 52 + enable = true 53 + }, 54 + } 55 + } 56 + }) 57 + 36 58 lspconfig.zls.setup({ 37 59 on_attach = on_attach, 38 60 settings = { ··· 60 82 ['<C-Space>'] = cmp.mapping.complete(), 61 83 ['<C-e>'] = cmp.mapping.abort(), 62 84 ['<CR>'] = cmp.mapping.confirm({ select = true }), 85 + ['<C-p>'] = cmp.mapping.select_prev_item(), 86 + ['<C-n>'] = cmp.mapping.select_next_item(), 63 87 }), 64 88 sources = cmp.config.sources({ 65 - { name = 'nvim_lsp' }, 66 - }, { 67 - { name = 'buffer' }, 89 + {name = 'nvim_lsp' }, 90 + {name = 'buffer' }, 91 + {name = 'path' }, 68 92 }) 69 93 }) 70 94 end,