Fix lua_ls setup, add some documentation

This commit is contained in:
Marko Korhonen 2023-11-18 22:31:15 +02:00
parent 168742d109
commit 769fcf82ef
Signed by: FunctionalHacker
GPG key ID: A7F78BCB859CD890
4 changed files with 18 additions and 35 deletions

View file

@ -1,17 +1,29 @@
-- Package manager for LSP servers, DAP adapters etc.
-- It also handles starting all of my LSP servers
return {
"williamboman/mason.nvim",
dependencies = {
"neovim/nvim-lspconfig",
"williamboman/mason-lspconfig.nvim",
"WhoIsSethDaniel/mason-tool-installer.nvim",
-- Extended functionality for jdtls
"mfussenegger/nvim-jdtls",
-- Neovim setup for init.lua and plugin development with full signature help, docs and completion for the nvim lua API.
{
"folke/neodev.nvim",
opts = {
override = function(root_dir, library)
library.enabled = true
library.plugins = true
end,
},
},
},
config = function()
require("mason").setup()
local mason_lsp = require("mason-lspconfig")
local lsp_utils = require('lsp_utils')
local lsp_utils = require("lsp_utils")
local capabilities = lsp_utils.get_capabilities()
mason_lsp.setup()
@ -24,32 +36,6 @@ return {
})
end,
-- Override lua_ls settings
["lua_ls"] = function()
require("lspconfig").lua_ls.setup({
on_attach = lsp_utils.on_attach,
capabilities = capabilities,
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { "vim" },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = { enable = false },
},
},
})
end,
-- Don't set up jdtls, it is set up by nvim-jdtls
["jdtls"] = function() end,
})