maybe: seeing if we can get away without lazydev and just doing simpler setup
This commit is contained in:
parent
7ea937dbc5
commit
0c17d320bb
94
init.lua
94
init.lua
|
|
@ -463,18 +463,6 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
|
|
||||||
-- LSP Plugins
|
-- LSP Plugins
|
||||||
{
|
|
||||||
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
|
||||||
-- used for completion, annotations and signatures of Neovim apis
|
|
||||||
'folke/lazydev.nvim',
|
|
||||||
ft = 'lua',
|
|
||||||
opts = {
|
|
||||||
library = {
|
|
||||||
-- Load luvit types when the `vim.uv` word is found
|
|
||||||
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
-- Main LSP Configuration
|
-- Main LSP Configuration
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
|
|
@ -669,22 +657,6 @@ require('lazy').setup({
|
||||||
--
|
--
|
||||||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||||
-- ts_ls = {},
|
-- ts_ls = {},
|
||||||
--
|
|
||||||
|
|
||||||
lua_ls = {
|
|
||||||
-- cmd = { ... },
|
|
||||||
-- filetypes = { ... },
|
|
||||||
-- capabilities = {},
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
completion = {
|
|
||||||
callSnippet = 'Replace',
|
|
||||||
},
|
|
||||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
|
||||||
-- diagnostics = { disable = { 'missing-fields' } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Ensure the servers and tools above are installed
|
-- Ensure the servers and tools above are installed
|
||||||
|
|
@ -704,22 +676,58 @@ require('lazy').setup({
|
||||||
vim.list_extend(ensure_installed, {
|
vim.list_extend(ensure_installed, {
|
||||||
'stylua', -- Used to format Lua code
|
'stylua', -- Used to format Lua code
|
||||||
})
|
})
|
||||||
|
|
||||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||||
|
|
||||||
require('mason-lspconfig').setup {
|
require('mason-lspconfig').setup {
|
||||||
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
ensure_installed = { 'lua_ls' },
|
||||||
automatic_installation = false,
|
|
||||||
handlers = {
|
|
||||||
function(server_name)
|
|
||||||
local server = servers[server_name] or {}
|
|
||||||
-- This handles overriding only values explicitly passed
|
|
||||||
-- by the server configuration above. Useful when disabling
|
|
||||||
-- certain features of an LSP (for example, turning off formatting for ts_ls)
|
|
||||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
|
||||||
require('lspconfig')[server_name].setup(server)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for name, server in pairs(servers) do
|
||||||
|
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
||||||
|
vim.lsp.config(name, server)
|
||||||
|
vim.lsp.enable(name)
|
||||||
|
end
|
||||||
|
|
||||||
|
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',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Make the server aware of Neovim runtime files
|
||||||
|
workspace = {
|
||||||
|
checkThirdParty = false,
|
||||||
|
-- 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),
|
||||||
|
--
|
||||||
|
-- Alternatively:
|
||||||
|
-- library = {
|
||||||
|
-- vim.env.VIMRUNTIME,
|
||||||
|
-- -- Depending on the usage, you might want to add additional paths
|
||||||
|
-- -- here.
|
||||||
|
-- -- '${3rd}/luv/library',
|
||||||
|
-- -- '${3rd}/busted/library',
|
||||||
|
-- },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
settings = {
|
||||||
|
Lua = {},
|
||||||
|
},
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -795,7 +803,6 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
opts = {},
|
opts = {},
|
||||||
},
|
},
|
||||||
'folke/lazydev.nvim',
|
|
||||||
},
|
},
|
||||||
--- @module 'blink.cmp'
|
--- @module 'blink.cmp'
|
||||||
--- @type blink.cmp.Config
|
--- @type blink.cmp.Config
|
||||||
|
|
@ -841,10 +848,7 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
|
|
||||||
sources = {
|
sources = {
|
||||||
default = { 'lsp', 'path', 'snippets', 'lazydev' },
|
default = { 'lsp', 'path', 'snippets' },
|
||||||
providers = {
|
|
||||||
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
snippets = { preset = 'luasnip' },
|
snippets = { preset = 'luasnip' },
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue