tangled
alpha
login
or
join now
shailpatels.me
/
nvim
0
fork
atom
nvim dot files
0
fork
atom
overview
issues
pulls
pipelines
add rust to lsp config
shailpatels.me
2 years ago
51ff4843
a994b372
+28
-4
1 changed file
expand all
collapse all
unified
split
lua
plugins
lsp.lua
+28
-4
lua/plugins/lsp.lua
···
11
11
"williamboman/mason-lspconfig.nvim",
12
12
config = function()
13
13
require('mason-lspconfig').setup({
14
14
-
ensure_installed = { "pyright", "tsserver", "rust_analyzer" },
14
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
36
+
lspconfig.rust_analyzer.setup({
37
37
+
on_attach = on_attach,
38
38
+
settings = {
39
39
+
["rust-analyzer"] = {
40
40
+
imports = {
41
41
+
granularity = {
42
42
+
group = "module",
43
43
+
},
44
44
+
prefix = "self",
45
45
+
},
46
46
+
cargo = {
47
47
+
buildScripts = {
48
48
+
enable = true,
49
49
+
},
50
50
+
},
51
51
+
procMacro = {
52
52
+
enable = true
53
53
+
},
54
54
+
}
55
55
+
}
56
56
+
})
57
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
85
+
['<C-p>'] = cmp.mapping.select_prev_item(),
86
86
+
['<C-n>'] = cmp.mapping.select_next_item(),
63
87
}),
64
88
sources = cmp.config.sources({
65
65
-
{ name = 'nvim_lsp' },
66
66
-
}, {
67
67
-
{ name = 'buffer' },
89
89
+
{name = 'nvim_lsp' },
90
90
+
{name = 'buffer' },
91
91
+
{name = 'path' },
68
92
})
69
93
})
70
94
end,