Files
my-nvim/lua/crentist/lazy/lsp.lua
T

119 lines
3.8 KiB
Lua

return {
'neovim/nvim-lspconfig',
version = '^2.3.0',
dependencies = {
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'saghen/blink.cmp',
'L3MON4D3/LuaSnip',
'j-hui/fidget.nvim',
'rafamadriz/friendly-snippets',
{
'folke/lazydev.nvim',
ft = 'lua', -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
{ path = '/usr/share/swayimg/', words = { 'swayimg' } },
{ path = '/usr/share/hypr/stubs', words = { 'hypr' } },
},
},
},
},
config = function()
vim.lsp.codelens.enable(true)
vim.diagnostic.config({ virtual_text = false })
-- load snippets from friendly-snippets
require('luasnip.loaders.from_vscode').lazy_load()
require('fidget').setup({})
require('mason').setup({})
---@module 'mason-lspconfig'
---@type MasonLspconfigSettings
require('mason-lspconfig').setup({
automatic_enable = true,
ensure_installed = {
'ts_ls',
'lua_ls',
'gopls',
'pylsp',
'gitlab_ci_ls',
'yamlls',
'ansiblels',
'terraformls',
'helm_ls',
'marksman',
'buf_ls',
'tflint',
},
})
local lazydev = require('lazydev')
vim.lsp.config('lua_ls', {
root_dir = function(bufnr, on_dir) on_dir(lazydev.find_workspace(bufnr)) end,
})
---@module 'lspconfig'
---@type lspconfig.Config
vim.lsp.config('pylsp', {
settings = {
pylsp = {
plugins = {
autopep8 = {
enabled = false,
},
yapf = {
enabled = true,
},
pycodestyle = {
ignore = { 'W391' },
maxLineLength = 95,
}
}
}
}
})
vim.lsp.config('helm_ls', {
settings = {
helm_ls = {
yamlls = { enabled = false },
},
}
})
local schemas_dir = vim.fs.joinpath(vim.fn.stdpath('config'), '/schemas')
vim.lsp.config('yamlls', {
filetypes = { 'yaml', 'yaml.gitlab' },
settings = {
yaml = {
schemaStore = { enable = false },
schemas = {
['https://gitlab.com/gitlab-org/gitlab-foss/-/raw/master/app/assets/javascripts/editor/schema/ci.json'] = {
'**/*.gitlab-ci.yml',
'**/pipelines/*.yml',
'**/pipelines/*.yaml',
},
[vim.fs.joinpath(schemas_dir, '/vector-v0.53.0-schema.json')] = {
'**/vector.yaml'
},
['https://github.com/SchemaStore/schemastore/raw/refs/heads/master/src/schemas/json/kustomization.json'] = {
'**/kustomization.yaml'
}
}
},
}
})
vim.lsp.config('terraformls', {
filetypes = { 'terraform', 'terraform-vars' },
root_markers = { { 'main.tf', '.terraform.lock.hcl' }, '.git' }
})
end
}