Repository navigation
Expand file tree
/
Copy pathmason_nvim.lua
More file actions
113 lines (98 loc) · 2.62 KB
/
Copy pathmason_nvim.lua
File metadata and controls
113 lines (98 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
local masonConfig = {
ui = {
width = 0.8,
height = 0.9,
icons = {
package_installed = "✓",
package_pending = "➜",
package_uninstalled = "✗",
},
keymaps = {
-- Keymap to expand a package
toggle_package_expand = "<CR>",
-- Keymap to install the package under the current cursor position
install_package = "i",
-- Keymap to reinstall/update the package under the current cursor position
update_package = "u",
-- Keymap to check for new version for the package under the current cursor position
check_package_version = "c",
-- Keymap to update all installed packages
update_all_packages = "U",
-- Keymap to check which installed packages are outdated
check_outdated_packages = "C",
-- Keymap to uninstall a package
uninstall_package = "X",
-- Keymap to cancel a package installation
cancel_installation = "<C-c>",
-- Keymap to apply language filter
apply_language_filter = "<C-f>",
}
}
}
local M = {
'williamboman/mason.nvim',
config = function ()
local mason = require('mason')
local mason_lsp = require('mason-lspconfig')
local capab = require('cmp_nvim_lsp').default_capabilities()
local function on_attach(_, buf)
local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(buf, ...)
end
require('keybindings').lsp(buf_set_keymap)
end
mason.setup(masonConfig)
mason_lsp.setup({
ensure_installed = { 'ast_grep', 'eslint', 'ts_ls', 'tailwindcss', 'prismals', 'lua_ls' },
})
vim.lsp.enable('ast_grep')
vim.lsp.enable('dartls')
vim.lsp.enable('eslint')
vim.lsp.enable('ts_ls')
vim.lsp.enable('tailwindcss')
vim.lsp.enable('prismals')
vim.lsp.enable('lua_ls')
vim.lsp.config('lua_ls', {
on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if
path ~= vim.fn.stdpath('config')
and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc'))
then
return
end
end
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
runtime = {
version = 'LuaJIT',
path = {
'lua/?.lua',
'lua/?/init.lua',
},
},
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
vim.api.nvim_get_runtime_file("lua/lspconfig", false)[1],
},
},
})
end,
settings = {
Lua = {},
},
})
vim.lsp.config('*', {
on_attach = on_attach,
capabilities = capab
})
require('lsp.ui')
end,
dependencies = {
'neovim/nvim-lspconfig',
'williamboman/mason-lspconfig.nvim',
}
}
return M