|
|
@ -3,7 +3,7 @@ local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nv
|
|
|
|
local is_bootstrap = false
|
|
|
|
local is_bootstrap = false
|
|
|
|
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
|
|
|
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
|
|
|
is_bootstrap = true
|
|
|
|
is_bootstrap = true
|
|
|
|
vim.fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
|
|
|
vim.fn.system { 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }
|
|
|
|
vim.cmd [[packadd packer.nvim]]
|
|
|
|
vim.cmd [[packadd packer.nvim]]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -335,60 +335,63 @@ end
|
|
|
|
-- Setup mason so it can manage external tooling
|
|
|
|
-- Setup mason so it can manage external tooling
|
|
|
|
require('mason').setup()
|
|
|
|
require('mason').setup()
|
|
|
|
|
|
|
|
|
|
|
|
-- Enable the following language servers
|
|
|
|
|
|
|
|
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed
|
|
|
|
|
|
|
|
local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'gopls' }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Ensure the servers above are installed
|
|
|
|
|
|
|
|
require('mason-lspconfig').setup {
|
|
|
|
|
|
|
|
ensure_installed = servers,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- nvim-cmp supports additional completion capabilities
|
|
|
|
-- nvim-cmp supports additional completion capabilities
|
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
|
|
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
|
|
|
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
|
|
|
|
|
|
|
|
|
|
|
for _, lsp in ipairs(servers) do
|
|
|
|
-- Configure language servers
|
|
|
|
require('lspconfig')[lsp].setup {
|
|
|
|
-- Automatically install language servers
|
|
|
|
on_attach = on_attach,
|
|
|
|
-- Set up a default handler for language servers, and a custom one as an example
|
|
|
|
capabilities = capabilities,
|
|
|
|
local mason_lspconfig = require 'mason-lspconfig'
|
|
|
|
}
|
|
|
|
mason_lspconfig.setup {
|
|
|
|
end
|
|
|
|
automatic_installation = true,
|
|
|
|
|
|
|
|
}
|
|
|
|
-- Turn on lsp status information
|
|
|
|
|
|
|
|
require('fidget').setup()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Example custom configuration for lua
|
|
|
|
mason_lspconfig.setup_handlers {
|
|
|
|
--
|
|
|
|
-- Default handler
|
|
|
|
-- Make runtime files discoverable to the server
|
|
|
|
function(server_name)
|
|
|
|
local runtime_path = vim.split(package.path, ';')
|
|
|
|
require('lspconfig')[server_name].setup {
|
|
|
|
table.insert(runtime_path, 'lua/?.lua')
|
|
|
|
capabilities = capabilities,
|
|
|
|
table.insert(runtime_path, 'lua/?/init.lua')
|
|
|
|
on_attach = on_attach,
|
|
|
|
|
|
|
|
}
|
|
|
|
require('lspconfig').sumneko_lua.setup {
|
|
|
|
end,
|
|
|
|
on_attach = on_attach,
|
|
|
|
['sumneko_lua'] = function()
|
|
|
|
capabilities = capabilities,
|
|
|
|
-- Example custom configuration for lua
|
|
|
|
settings = {
|
|
|
|
--
|
|
|
|
Lua = {
|
|
|
|
-- Make runtime files discoverable to the server
|
|
|
|
runtime = {
|
|
|
|
local runtime_path = vim.split(package.path, ';')
|
|
|
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT)
|
|
|
|
table.insert(runtime_path, 'lua/?.lua')
|
|
|
|
version = 'LuaJIT',
|
|
|
|
table.insert(runtime_path, 'lua/?/init.lua')
|
|
|
|
-- Setup your lua path
|
|
|
|
|
|
|
|
path = runtime_path,
|
|
|
|
require('lspconfig').sumneko_lua.setup {
|
|
|
|
},
|
|
|
|
on_attach = on_attach,
|
|
|
|
diagnostics = {
|
|
|
|
capabilities = capabilities,
|
|
|
|
globals = { 'vim' },
|
|
|
|
settings = {
|
|
|
|
},
|
|
|
|
Lua = {
|
|
|
|
workspace = {
|
|
|
|
runtime = {
|
|
|
|
library = vim.api.nvim_get_runtime_file('', true),
|
|
|
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT)
|
|
|
|
checkThirdParty = false,
|
|
|
|
version = 'LuaJIT',
|
|
|
|
|
|
|
|
-- Setup your lua path
|
|
|
|
|
|
|
|
path = runtime_path,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
diagnostics = {
|
|
|
|
|
|
|
|
globals = { 'vim' },
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
workspace = {
|
|
|
|
|
|
|
|
library = vim.api.nvim_get_runtime_file('', true),
|
|
|
|
|
|
|
|
checkThirdParty = false,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
-- Do not send telemetry data containing a randomized but unique identifier
|
|
|
|
|
|
|
|
telemetry = { enable = false },
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
-- Do not send telemetry data containing a randomized but unique identifier
|
|
|
|
}
|
|
|
|
telemetry = { enable = false },
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Turn on lsp status information
|
|
|
|
|
|
|
|
require('fidget').setup()
|
|
|
|
|
|
|
|
|
|
|
|
-- nvim-cmp setup
|
|
|
|
-- nvim-cmp setup
|
|
|
|
local cmp = require 'cmp'
|
|
|
|
local cmp = require 'cmp'
|
|
|
|
local luasnip = require 'luasnip'
|
|
|
|
local luasnip = require 'luasnip'
|
|
|
|