61 lines
1.8 KiB
Lua
61 lines
1.8 KiB
Lua
|
|
return {
|
||
|
|
{
|
||
|
|
"williamboman/mason.nvim",
|
||
|
|
config = function()
|
||
|
|
require("mason").setup()
|
||
|
|
end,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"williamboman/mason-lspconfig.nvim",
|
||
|
|
config = function()
|
||
|
|
require("mason-lspconfig").setup({
|
||
|
|
ensure_installed = { "lua_ls", "ts_ls" },
|
||
|
|
})
|
||
|
|
end,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"neovim/nvim-lspconfig",
|
||
|
|
config = function()
|
||
|
|
local lspconfig = require("lspconfig")
|
||
|
|
lspconfig.lua_ls.setup({
|
||
|
|
on_init = function(client)
|
||
|
|
if client.workspace_folders then
|
||
|
|
local path = client.workspace_folders[1].name
|
||
|
|
if 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 = {
|
||
|
|
-- Tell the language server which version of Lua you're using
|
||
|
|
-- (most likely LuaJIT in the case of Neovim)
|
||
|
|
version = 'LuaJIT'
|
||
|
|
},
|
||
|
|
-- Make the server aware of Neovim runtime files
|
||
|
|
workspace = {
|
||
|
|
checkThirdParty = false,
|
||
|
|
library = {
|
||
|
|
vim.env.VIMRUNTIME,
|
||
|
|
-- Depending on the usage, you might want to add additional paths here.
|
||
|
|
"${3rd}/luv/library"
|
||
|
|
-- "${3rd}/busted/library",
|
||
|
|
}
|
||
|
|
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower and will cause issues when working on your own configuration (see https://github.com/neovim/nvim-lspconfig/issues/3189)
|
||
|
|
-- library = vim.api.nvim_get_runtime_file("", true)
|
||
|
|
}
|
||
|
|
})
|
||
|
|
end,
|
||
|
|
settings = {
|
||
|
|
Lua = {}
|
||
|
|
}
|
||
|
|
|
||
|
|
})
|
||
|
|
lspconfig.ts_ls.setup({})
|
||
|
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
|
||
|
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {})
|
||
|
|
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, {})
|
||
|
|
end,
|
||
|
|
},
|
||
|
|
}
|